本文整理汇总了PHP中XoopsPersistableObjectHandler类的典型用法代码示例。如果您正苦于以下问题:PHP XoopsPersistableObjectHandler类的具体用法?PHP XoopsPersistableObjectHandler怎么用?PHP XoopsPersistableObjectHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XoopsPersistableObjectHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* 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;
}
示例2: delete
/**
* 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;
}
示例3: insert
function insert(&$object, $force = true)
{
if ($ret = parent::insert($object, $force)) {
$object->unsetNew();
}
return $ret;
}
示例4: countRelated
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();
}
示例5: getCatIds
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;
}
示例6: getAllByFieldId
/**
* 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;
}
示例7: delete
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;
}
}
示例8: getStats
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);
}
示例9:
function __construct(&$db)
{
parent::__construct($db, "tdmcreate_modules", 'tdmcreate_modules', 'modules_id', 'modules_name');
}
示例10: deleteAllByStatus
function deleteAllByStatus($status = MYINVITER_STATUS_WAITING)
{
$ret = parent::deleteAll(new Criteria('status', $status));
return $ret;
}
示例11: delete
/**
* 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;
}
示例12:
function __construct(&$db)
{
parent::__construct($db, 'profile_visibility', 'profilevisibility', 'field_id');
}
示例13: array
/**
* 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;
}
示例14: __construct
public function __construct(\Xoops\Core\Database\Connection $db, $table = '', $className = '', $keyName = '', $identifierName = '')
{
parent::__construct($db, $table, $className, $keyName, $identifierName);
}
示例15: __construct
/**
* @param null|XoopsDatabase $db
*/
public function __construct(XoopsDatabase $db)
{
parent::__construct($db, 'profile_category', 'profilecategory', 'cat_id', 'cat_title');
}