Ejemplo n.º 1
0
 /**
  * create an object with specified params
  * @param  array $p object properties
  * @return int   created id
  */
 public function create($p = false)
 {
     if ($p === false) {
         $p = $this->data;
     }
     // check input params
     if (!isset($p['target_id'])) {
         throw new \Exception("No target id specified for shortcut creation", 1);
     }
     //check if target is also shortuc and replace with its target
     if (Objects::getType($p['target_id']) == 'shortcut') {
         $res = DB\dbQuery('SELECT target_id
             FROM tree
             WHERE id = $1', $p['target_id']) or die(DB\dbQueryError());
         if ($r = $res->fetch_assoc()) {
             $p['target_id'] = $r['target_id'];
         }
         $res->close();
     }
     $p['name'] = 'link to #' . $p['target_id'];
     if (empty($p['template_id'])) {
         $p['template_id'] = \CB\Config::get('default_shortcut_template');
     }
     $this->data = $p;
     return parent::create($p);
 }
Ejemplo n.º 2
0
 /**
  * create a task with specified params
  * @param  array $p object properties
  * @return int   created id
  */
 public function create($p = false)
 {
     if ($p === false) {
         $p = $this->data;
     }
     $this->data = $p;
     $this->setParamsFromData($p);
     return parent::create($p);
 }
Ejemplo n.º 3
0
 /**
  * create method
  * @return void
  */
 public function create($p = false)
 {
     //disable default log from parent Object class
     //we'll set comments add as comment action for parent
     $disableLogFlag = \CB\Config::getFlag('disableActivityLog');
     \CB\Config::setFlag('disableActivityLog', true);
     $rez = parent::create($p);
     \CB\Config::setFlag('disableActivityLog', $disableLogFlag);
     $p =& $this->data;
     $this->parentObj = Objects::getCachedObject($p['pid']);
     $this->updateParentFollowers();
     $this->logAction('file_upload', array('file' => array('id' => $p['id'], 'name' => $p['name'])));
     return $rez;
 }
Ejemplo n.º 4
0
 /**
  * create method
  * @return void
  */
 public function create($p = false)
 {
     //disable default log from parent Object class
     //we'll set comments add as comment action for parent
     Config::setFlag('disableActivityLog', true);
     $rez = parent::create($p);
     Config::setFlag('disableActivityLog', false);
     $p =& $this->data;
     $this->parentObj = Objects::getCachedObject($p['pid']);
     $this->updateParentFollowers();
     // log the action
     $logParams = array('type' => 'file_upload', 'new' => $this->parentObj, 'file' => array('id' => $p['id'], 'name' => $p['name']));
     Log::add($logParams);
     return $rez;
 }
Ejemplo n.º 5
0
 /**
  * create method
  * @return void
  */
 public function create($p = false)
 {
     if ($p === false) {
         $p =& $this->data;
     }
     // if (!empty($p['data']['_title'])) {
     //     //all data is html escaped when indexed in solr
     //     //so no need to encode it here
     //     $msg = $this->processAndFormatMessage($p['data']['_title']);
     //     $p['name'] = $msg;
     //     $p['data']['_title'] = $msg;
     // }
     //disable default log from parent Object class
     //we'll set comments add as comment action for parent
     \CB\Config::setFlag('disableActivityLog', true);
     $rez = parent::create($p);
     \CB\Config::setFlag('disableActivityLog', false);
     $this->updateParentFollowers();
     $this->logAction('comment', array('new' => $this->getParentObject(), 'comment' => $p['data']['_title'], 'mentioned' => $this->lastMentionedUserIds));
     return $rez;
 }
Ejemplo n.º 6
0
 /**
  * create an object with specified params
  * @param  array $p object properties
  * @return int   created id
  */
 public function create($p = false)
 {
     if ($p === false) {
         $p = $this->data;
     }
     // check input params
     if (!isset($p['target_id'])) {
         throw new \Exception("No target id specified for shortcut creation", 1);
     }
     //check if target is also shortuc and replace with its target
     if (Objects::getType($p['target_id']) == 'shortcut') {
         $r = DM\Tree::read($p['target_id']);
         if (!empty($r)) {
             $p['target_id'] = $r['target_id'];
         }
     }
     $p['name'] = 'link to #' . $p['target_id'];
     if (empty($p['template_id'])) {
         $p['template_id'] = \CB\Config::get('default_shortcut_template');
     }
     $this->data = $p;
     return parent::create($p);
 }
Ejemplo n.º 7
0
 /**
  * create method
  * @return void
  */
 public function create($p = false)
 {
     if ($p === false) {
         $p =& $this->data;
     }
     // if (!empty($p['data']['_title'])) {
     //     //all data is html escaped when indexed in solr
     //     //so no need to encode it here
     //     $msg = $this->processAndFormatMessage($p['data']['_title']);
     //     $p['name'] = $msg;
     //     $p['data']['_title'] = $msg;
     // }
     //disable default log from parent Object class
     //we'll set comments add as comment action for parent
     Config::setFlag('disableActivityLog', true);
     $rez = parent::create($p);
     Config::setFlag('disableActivityLog', false);
     $this->parentObj = Objects::getCachedObject($p['pid']);
     $this->updateParentFollowers();
     // log the action
     $logParams = array('type' => 'comment', 'new' => $this->parentObj, 'comment' => $p['data']['_title']);
     Log::add($logParams);
     return $rez;
 }