Beispiel #1
0
 /**
  * internal function to collect data for data model update
  * @return array
  */
 protected function collectModelData()
 {
     $p =& $this->data;
     if (empty($p['pid'])) {
         $p['pid'] = null;
     }
     $draftPid = empty($p['draftPid']) ? null : $p['draftPid'];
     $isDraft = intval(!empty($draftPid) || !empty($p['draft']));
     if (empty($p['date_end'])) {
         $p['date_end'] = null;
     }
     if (empty($p['tag_id'])) {
         $p['tag_id'] = null;
     }
     if (empty($p['cid'])) {
         $p['cid'] = User::getId();
     }
     if (empty($p['oid'])) {
         $p['oid'] = $p['cid'];
     }
     if (empty($p['cdate'])) {
         $p['cdate'] = null;
     }
     $r = DM\Tree::collectData($p);
     $r = array_merge($r, array('id' => $this->id, 'draft' => $isDraft, 'draft_pid' => $draftPid, 'cdate' => Util\coalesce(@$r['cdate'], 'CURRENT_TIMESTAMP'), 'system' => @intval($r['system']), 'updated' => 1));
     return $r;
 }