當前位置: 首頁>>代碼示例>>PHP>>正文


PHP xPDOSimpleObject類代碼示例

本文整理匯總了PHP中xPDOSimpleObject的典型用法代碼示例。如果您正苦於以下問題:PHP xPDOSimpleObject類的具體用法?PHP xPDOSimpleObject怎麽用?PHP xPDOSimpleObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了xPDOSimpleObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 public function save($cacheFlag = null)
 {
     if ($isNew = $this->isNew()) {
         /*if(!$this->get('createdon')){
               $this->set('createdon', time());
           }
           
           if(!$this->get('createdby')){
               $this->set('createdby', $this->xpdo->user->id ? $this->xpdo->user->id : null);
           }*/
         $this->set('ip', $this->getUserIP());
     }
     if (!$this->get('parent')) {
         $this->set('parent', null);
     }
     /*
             Не делаем так, потому что иначе при обновлении дочерних комментов
             у нас все родительские комменты будут тоже обновленными
             else{
                 if(!$this->get('editedon')){
                     $this->set('editedon', time());
                 }
             }*/
     $rt = parent::save($cacheFlag);
     /*
         If saved and it`s was new comment, recalculate total comments
     */
     if ($rt && $isNew) {
         $this->recalculateParentComments(1);
     }
     return $rt;
 }
開發者ID:bendasvadim,項目名稱:NewsModxBox,代碼行數:32,代碼來源:societycomment.class.php

示例2: save

 public function save($cacheFlag = null)
 {
     if (empty($this->key)) {
         $this->key = md5($this->id . time() . $this->dir_name);
     }
     return parent::save($cacheFlag);
 }
開發者ID:pixelfanatiker,項目名稱:Git-Package-Management,代碼行數:7,代碼來源:gitpackage.class.php

示例3: save

 public function save($cacheFlag = null)
 {
     if ($this->alias == '') {
         $this->set('alias', $this->generateUniqueAlias($this->name));
     }
     return parent::save($cacheFlag);
 }
開發者ID:hansek,項目名稱:Tagger,代碼行數:7,代碼來源:taggergroup.class.php

示例4: remove

 /**
  * Overrides xPDOObject::remove to fire modX-specific events
  *
  * {@inheritDoc}
  */
 public function remove(array $ancestors = array())
 {
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('OnUserGroupBeforeRemove', array('usergroup' => &$this, 'ancestors' => $ancestors));
     }
     $removed = parent::remove($ancestors);
     // delete ACLs for this group
     $targets = explode(',', $this->xpdo->getOption('principal_targets', null, 'modAccessContext,modAccessResourceGroup,modAccessCategory'));
     array_walk($targets, 'trim');
     foreach ($targets as $target) {
         $fields = $this->xpdo->getFields($target);
         if (array_key_exists('principal_class', $fields) && array_key_exists('principal', $fields)) {
             $tablename = $this->xpdo->getTableName($target);
             $principal_class_field = $this->xpdo->escape('principal_class');
             $principal_field = $this->xpdo->escape('principal');
             if (!empty($tablename)) {
                 $this->xpdo->query("DELETE FROM {$tablename} WHERE {$principal_class_field} = 'modUserGroup' AND {$principal_field} = {$this->_fields['id']}");
             }
         }
     }
     if ($this->xpdo instanceof modX) {
         $this->xpdo->invokeEvent('OnUserGroupRemove', array('usergroup' => &$this, 'ancestors' => $ancestors));
     }
     return $removed;
 }
開發者ID:adamwintle,項目名稱:flexibility5,代碼行數:30,代碼來源:modusergroup.class.php

示例5: array

 /**
  * Override getOne to get the appropriate Principal class.
  *
  * @param $alias
  * @param null $criteria
  * @param bool $cacheFlag
  * @return null|xPDOObject
  */
 public function &getOne($alias, $criteria = null, $cacheFlag = true)
 {
     $object = null;
     if ($alias === 'Principal') {
         if ($fkdef = $this->getFKDefinition($alias)) {
             $k = $fkdef['local'];
             $fk = $fkdef['foreign'];
             if (isset($this->_relatedObjects[$alias])) {
                 if (is_object($this->_relatedObjects[$alias])) {
                     $object =& $this->_relatedObjects[$alias];
                     return $object;
                 }
             }
             if ($criteria === null) {
                 $criteria = array($fk => $this->get($k));
             }
             $fkdef['class'] = $this->get('principal_class');
             if ($object = $this->xpdo->getObject($fkdef['class'], $criteria, $cacheFlag)) {
                 $this->_relatedObjects[$alias] = $object;
             }
         }
     } else {
         $object = parent::getOne($alias, $criteria, $cacheFlag);
     }
     return $object;
 }
開發者ID:ChrstnMgcn,項目名稱:revolution,代碼行數:34,代碼來源:modaccess.class.php

示例6: save

 public function save($cacheFlag = NULL)
 {
     if (!$this->get('topicid') && empty($this->_relatedObjects['Topic']) or !$this->get('blogid') && empty($this->_relatedObjects['Blog'])) {
         return false;
     }
     return parent::save($cacheFlag);
 }
開發者ID:bendasvadim,項目名稱:NewsModxBox,代碼行數:7,代碼來源:societyblogtopic.class.php

示例7: set

 /**
  * Make sure we clean up names
  */
 public function set($k, $v = null, $vType = '')
 {
     if ($k == 'name') {
         $v = strip_tags(trim(preg_replace('/\\s+/', ' ', $v)));
     }
     return parent::set($k, $v, $vType);
 }
開發者ID:carnevlu,項目名稱:repoman,代碼行數:10,代碼來源:review.class.php

示例8: save

 public function save($cacheFlag = null)
 {
     if ($this->isNew()) {
         $this->set('createdon', strftime('%Y-%m-%d %H:%M:%S'));
     }
     return parent::save($cacheFlag);
 }
開發者ID:raadhuis,項目名稱:modx-basic,代碼行數:7,代碼來源:quipcommentnotify.class.php

示例9: save

 public function save($cacheFlag = null)
 {
     $preventsave = $this->get('preventsave');
     $published = $this->get('published');
     $this->event = $this->getOne('Event');
     //handle enddate - enddate can't be lower than startdate
     $enddate = $this->get('enddate');
     $startdate = $this->get('startdate');
     if ($enddate <= $startdate) {
         $this->set('enddate', $startdate);
     }
     //handle allday
     $this->handleAllday();
     $active = true;
     if (empty($published)) {
         $active = false;
     }
     if ($active) {
         if (!$this->handleDouble()) {
             return true;
         }
         if (!$this->handleDoubleInAssignedCats()) {
             return true;
         }
     }
     if (!$preventsave) {
         return parent::save($cacheFlag);
     } else {
         return true;
     }
 }
開發者ID:Piterden,項目名稱:modx_testfloor,代碼行數:31,代碼來源:migxcalendardates.class.php

示例10: save

 /**
  * Overrides xPDOObject::save to clear lexicon cache on saving.
  *
  * {@inheritdoc}
  */
 public function save($cacheFlag = null)
 {
     $saved = parent::save($cacheFlag);
     if ($saved && empty($this->xpdo->config[xPDO::OPT_SETUP])) {
         $this->clearCache();
     }
     return $saved;
 }
開發者ID:JoeBlow,項目名稱:revolution,代碼行數:13,代碼來源:modlexicontopic.class.php

示例11: save

 public function save($cacheFlag = NULL)
 {
     if (!$this->get('resourceid')) {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Resource ID is null");
         return false;
     }
     return parent::save($cacheFlag);
 }
開發者ID:bendasvadim,項目名稱:NewsModxBox,代碼行數:8,代碼來源:societytopicattributes.class.php

示例12: remove

 /** {@inheritdoc} */
 public function remove(array $ancestors = array())
 {
     $id = $this->get('id');
     $table = $this->xpdo->getTableName('msDeliveryMember');
     $sql = "DELETE FROM {$table} WHERE `delivery_id` = '{$id}';";
     $this->xpdo->exec($sql);
     return parent::remove();
 }
開發者ID:volkovnd,項目名稱:miniShop2,代碼行數:9,代碼來源:msdelivery.class.php

示例13: remove

 public function remove(array $ancestors = array())
 {
     $removed = parent::remove($ancestors);
     if ($removed && !$this->getOption(xPDO::OPT_SETUP)) {
         $this->xpdo->call('modExtensionPackage', 'clearCache', array(&$this->xpdo));
     }
     return $removed;
 }
開發者ID:raadhuis,項目名稱:modx-basic,代碼行數:8,代碼來源:modextensionpackage.class.php

示例14: save

 /**
  * Overrides xPDOObject::save to set the createdon date.
  *
  * {@inheritdoc}
  */
 public function save($cacheFlag = null)
 {
     if ($this->_new && !$this->get('created')) {
         $this->set('created', strftime('%Y-%m-%d %H:%M:%S'));
     }
     $saved = parent::save($cacheFlag);
     return $saved;
 }
開發者ID:JoeBlow,項目名稱:revolution,代碼行數:13,代碼來源:modworkspace.class.php

示例15: get

 public function get($k, $format = null, $formatTemplate = null)
 {
     if ($k == 'badge') {
         $v = $this->getBadge();
     } else {
         $v = parent::get($k, $format, $formatTemplate);
     }
     return $v;
 }
開發者ID:oneismore,項目名稱:Discuss,代碼行數:9,代碼來源:disusergroupprofile.class.php


注:本文中的xPDOSimpleObject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。