-
MODX Staff
- 2,502 Posts
I tried adding it as follows:
function InsertUnPubDate($data) {
global $modx;
$table_name = $modx->getFullTableName( 'site_content' );
$fields = $data['unpub_date']);
$modx->db->insert( $fields, $table_name);
}
$arr = $modx->getTemplateVarOutput('event_date');
$aday = 84600;
$edate = $arr[event_date];
$data = $edate + $aday;
$_POST['unpub_date'] = $data;
if (!isset($edate))
{exit();}
else {InsertUnPubDate($_POST['unpub_date'];}
but nothing.
Hrmm...
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
-
MODX Staff
- 2,502 Posts
Susan, I am assuming since you retracted the info re the document array that you don’t think that it will actually work. I did try it but I also found an error in my code and after fixing it it wasn’t working still.
The last post is where I last left off.
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
-
☆ A M B ☆
- 24,524 Posts
somehow I got turned around and thought this was a regular Manager document editing process... shouldn’t answer forum issues when I have a bad cold! Sorry for the confusion...
Was this ever resolved? I need the same thing, only 2 weeks after a post has been made. Did the snippet SmashingRed wrote work? Guess I’ll have to try it myself.
-
MODX Staff
- 2,502 Posts
I didn’t get this resolved wholly since there was a problem with saving the data. It never ended being critical to the project. I decided to move on. ER if you decide to move ahead, please let us know your progress here.
Cheers,
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
I use my Xett to manage events. Here is the function where I store the edited event. In this case I use the docmanager
<?php
require_once($Xettpath.'document.class.inc.php');
$createdby=$modx->getLoginUserID();
$rows = $this->getformfields();
$time=time();
$parent=$this->xetconfig['custom']['zeiten_parent'];
$template=$this->xetconfig['custom']['zeiten_template'];
$unpubtime=$this->xetconfig['custom']['unpublish_days']*86400;
if ($_POST['aktion']=='edit'){
//print_r($rows);
foreach ($rows as $row){
$start=xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Time`']);
$unpub=$row['`Time`']+$unpubtime;
$doc = new Document($row['`docid`']);
$doc->Set('parent',$parent);
//$doc->Set('content',$row['`content`']);
$doc->Set('description',$row['`description`']);
$doc->Set('template',$template);
$doc->Set('pagetitle','Sendezeit '.$start);
$doc->Set('longtitle','Sendezeit '.$start);
$doc->Set('menutitle','Sendezeit '.$start);
$doc->Set('cacheable','0');
$doc->Set('hidemenu','1');
$doc->Set('published',$row['`published`']);
$doc->Set('isfolder','0');
$doc->Set('unpub_date',$unpub);
$doc->Set('editedby',$createdby);
//$doc->Set('createdon',$time);
$doc->Set('editedon',$time);
//$doc->Set('publishedon',$createdby);
$doc->Set('tvmoderator',$row['`moderatorId`']);
$doc->Set('tvsendungstyp',$row['`category_ID`']);
$doc->Set('tvEasyEvents_Start',xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Time`']));
$doc->Set('tvEasyEvents_End',xetadodb_strftime("%d-%m-%Y %H:%M:%S", $row['`Timeend`']));
$doc->Save();
$parent = $doc->fields['id'];
//$output.='$docids'."['vcal_eventcal']='".$parent."';<br/>";
}
}
?>