function insert(&$object, $force = true) { if ($ret = parent::insert($object, $force)) { $object->unsetNew(); } return $ret; }
/** * Delete an object from the database * @see XoopsPersistableObjectHandler * * @param profileRegstep $obj * @param bool $force * * @return bool */ function delete($obj, $force = false) { if (parent::delete($obj, $force)) { $field_handler =& xoops_getmodulehandler('field'); return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id'))); } return false; }
/** * Delete an object from the database * @see XoopsPersistableObjectHandler * * @param XoopsObject $obj * @param bool $force * * @return bool */ public function delete(XoopsObject $obj, $force = false) { if (parent::delete($obj, $force)) { $field_handler = xoops_getModuleHandler('field'); return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')), $force); } return false; }
public function countRelated($start = 0, $limit = 0, $sort = 'related_name', $order = 'ASC') { $criteria = new CriteriaCompo(); $criteria->setSort($sort); $criteria->setOrder($order); $criteria->setStart($start); $criteria->setLimit($limit); return parent::getCount(); }
function getCatIds($uids = null) { if ($uids == null) { return false; } $criteria = new CriteriaCompo(); $criteria->add(new Criteria("uid", "(" . implode(", ", $uids) . ")", "in"), 'AND'); $cats = parent::getAll($criteria, null, false); return $cats; }
/** * get all rows matching a condition * * @param CriteriaElement $criteria {@link CriteriaElement} to match * * @return array of row arrays, indexed by field_id */ public function getAllByFieldId(CriteriaElement $criteria = null) { $rawRows = parent::getAll($criteria, null, false, false); usort($rawRows, array($this, 'visibilitySort')); $rows = array(); foreach ($rawRows as $rawRow) { $rows[$rawRow['field_id']][] = $rawRow; } return $rows; }
function delete(&$category) { global $xoopsModule; $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); $forum_handler->deleteAll(new Criteria("cat_id", $category->getVar('cat_id')), true, true); if ($result = parent::delete($category)) { // Delete group permissions return $this->deletePermission($category); } else { $category->setErrors("delete category error: " . $sql); return false; } }
public function getStats($content_id) { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('rating_content_id', $content_id)); $i = 0; $total = 0; $obj = parent::getAll($criteria); foreach ($obj as $k => $v) { ++$i; $total += $v->getVar('rating_rating'); } return array('voters' => $i, 'average' => $total / $i); }
function __construct(&$db) { parent::__construct($db, "tdmcreate_modules", 'tdmcreate_modules', 'modules_id', 'modules_name'); }
function deleteAllByStatus($status = MYINVITER_STATUS_WAITING) { $ret = parent::deleteAll(new Criteria('status', $status)); return $ret; }
/** * delete an item from the database * * @param object $item reference to the ITEM to delete * @param bool $force * * @return bool FALSE if failed. */ public function delete(&$item, $force = false) { // Deleting the files if (!$this->publisher->getHandler('file')->deleteItemFiles($item)) { $item->setErrors('An error while deleting a file.'); } if (!parent::delete($item, $force)) { $item->setErrors('An error while deleting.'); return false; } // Removing tags information if (xoops_isActiveModule('tag')) { $tag_handler = xoops_getmodulehandler('tag', 'tag'); $tag_handler->updateByItem('', $item->getVar('itemid'), PUBLISHER_DIRNAME, 0); } return true; }
function __construct(&$db) { parent::__construct($db, 'profile_visibility', 'profilevisibility', 'field_id'); }
/** * retrieve categories from the database * * @param object $criteria {@link CriteriaElement} conditions to be met * @param bool $idAsKey use the categoryid as key for the array? * * @return array array of {@link XoopsItem} objects */ public function &getObjects($criteria = null, $idAsKey = false) { $ret = array(); $theObjects =& parent::getObjects($criteria, true); foreach ($theObjects as $theObject) { if (!$idAsKey) { $ret[] = $theObject; } else { $ret[$theObject->categoryid()] = $theObject; } unset($theObject); } return $ret; }
public function __construct(\Xoops\Core\Database\Connection $db, $table = '', $className = '', $keyName = '', $identifierName = '') { parent::__construct($db, $table, $className, $keyName, $identifierName); }
/** * @param null|XoopsDatabase $db */ public function __construct(XoopsDatabase $db) { parent::__construct($db, 'profile_category', 'profilecategory', 'cat_id', 'cat_title'); }
function __construct(&$db) { parent::__construct($db, "genobio_sibblings", 'GenobioSibblings', "sibblings_id", "nickname"); }
/** * insert a new object in the database * * @param object $obj reference to the object * @param bool $force whether to force the query execution despite security settings * @param bool $checkObject check if the object is dirty and clean the attributes * * @return bool FALSE if failed, TRUE if already present and unchanged or successful */ function insert(&$obj, $force = false, $checkObject = true) { $uservars = $this->getUserVars(); foreach ($uservars as $var) { unset($obj->vars[$var]); } if (count($obj->vars) == 0) { return true; } return parent::insert($obj, $force, $checkObject); }
function __construct(&$db) { parent::__construct($db, 'support_category', 'SupportCategory', 'cat_id', 'cat_name'); }
function __construct(&$db) { parent::__construct($db, "spiders_user", 'SpidersSpiders_user', "spider_id", "uid"); }
function __construct($db) { parent::__construct($db, 'ranks', 'SystemUserrank', 'rank_id', 'rank_title'); }
/** * Mark a message as to_delete = 1 or removes it if the sender has also deleted it or sent by anonymous * * @param XoopsObject|PmMessage $pm * @param int $val * @return bool */ public function setTodelete(PmMessage $pm, $val = 1) { if ($pm->getVar('from_delete') == 0 && $pm->getVar('from_userid') == 0) { return $this->updateAll('to_delete', (int) $val, new Criteria('msg_id', $pm->getVar('msg_id'))); } else { return parent::delete($pm); } }
function __construct(&$db) { parent::__construct($db, "_", "foocategory", "_", '_'); }
/** * @param null|object $db */ function __construct($db) { parent::__construct($db, 'bannerfinish', 'SystemBannerFinish', 'bid', 'cid'); }
/** * @param null|object $db */ function __construct($db) { parent::__construct($db, 'smiles', 'SystemSmilies', 'id', 'code'); }
/** * @param null|XoopsDatabase $db */ public function __construct(XoopsDatabase $db) { parent::__construct($db, 'block_module_link', 'SystemBlockLinkModule', 'block_id', 'module_id'); }
function delete(&$obj, $force = false) { $sql = sprintf("DELETE FROM %s WHERE block_id = %u", $this->db->prefix('block_module_link'), $obj->getVar('instanceid')); if ($this->db->query($sql)) { $groupperm_handler =& xoops_gethandler('groupperm'); $criteria = new CriteriaCompo(new Criteria('gperm_modid', 1)); $criteria->add(new Criteria('gperm_name', 'block_read')); $criteria->add(new Criteria('gperm_itemid', $obj->getVar('instanceid'))); if ($groupperm_handler->deleteAll($criteria)) { return parent::delete($obj, $force); } } //@TODO: LOCALIZE $obj->setErrors("Could not delete instance link"); return false; }
/** * clean orphan links from database * * @return bool true on success */ function cleanOrphan() { return parent::cleanOrphan($this->db->prefix("tag_tag"), "tag_id"); }
function __construct(&$db) { parent::__construct($db, 'subscribers_user', 'SubscribersUser', 'user_id', 'user_email'); }
/** * Mark a message as to_delete = 1 or removes it if the sender has also deleted it * @param object $pm {@link XoopsPrivmessage} object * @return bool **/ function setTodelete(&$pm, $val = 1) { if ($pm->getVar('from_delete') == 0) { return $this->updateAll('to_delete', intval($val), new Criteria('msg_id', $pm->getVar('msg_id'))); } else { return parent::delete($pm); } }
public function getClone($content_id) { $values = parent::get($content_id)->toArray(); $values['content_id'] = 0; $values['content_title'] = PageLocale::CONTENT_COPY . $values['content_title']; $values['content_weight'] = 0; $values['content_hits'] = 0; $values['content_votes'] = 0; $values['content_rating'] = 0; $values['content_create'] = time(); $obj = parent::create(); $obj->setVars($values); return $obj; }