本文整理汇总了PHP中Publisher::getModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Publisher::getModule方法的具体用法?PHP Publisher::getModule怎么用?PHP Publisher::getModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publisher
的用法示例。
在下文中一共展示了Publisher::getModule方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTitle
/**
* @param string $title
*/
public function setTitle($title)
{
$this->_title = $this->html2text($title);
$this->_original_title = $this->_title;
$titleTag = array();
$titleTag['module'] = $this->publisher->getModule()->getVar('name');
if (isset($this->_title) && $this->_title != '' && strtoupper($this->_title) != strtoupper($titleTag['module'])) {
$titleTag['title'] = $this->_title;
}
if (isset($this->_categoryPath) && $this->_categoryPath != '') {
$titleTag['category'] = $this->_categoryPath;
}
$ret = isset($titleTag['title']) ? $titleTag['title'] : '';
if (isset($titleTag['category']) && $titleTag['category'] != '') {
if ($ret != '') {
$ret .= ' - ';
}
$ret .= $titleTag['category'];
}
if (isset($titleTag['module']) && $titleTag['module'] != '') {
if ($ret != '') {
$ret .= ' - ';
}
$ret .= $titleTag['module'];
}
$this->_title = $ret;
}
示例2: deletePermissions
/**
* Delete all permission for a specific item
* deletePermissions()
*
* @param integer $itemid id of the item for which to delete the permissions
* @param string $gperm_name permission name
*
* @return boolean : TRUE if the no errors occured
*/
public function deletePermissions($itemid, $gperm_name)
{
$xoops = Xoops::getInstance();
$result = true;
$gperm_handler = $xoops->getHandlerGroupperm();
$gperm_handler->deleteByModule($this->publisher->getModule()->getVar('mid'), $gperm_name, $itemid);
return $result;
}
示例3: delete
/**
* delete a category from the database
*
* @param XoopsObject $category reference to the category to delete
* @param bool $force
*
* @return bool FALSE if failed.
*/
public function delete(XoopsObject $category, $force = false)
{
$xoops = Xoops::getInstance();
// Deleting this category ITEMs
$criteria = new Criteria('categoryid', $category->getVar('categoryid'));
$this->publisher->getItemHandler()->deleteAll($criteria, true, true);
unset($criteria);
// Deleting the sub categories
$subcats = $this->getCategories(0, 0, $category->getVar('categoryid'));
foreach ($subcats as $subcat) {
$this->delete($subcat);
}
if (!parent::delete($category, $force)) {
$category->setErrors('An error while deleting.');
return false;
}
$module_id = $this->publisher->getModule()->getVar('mid');
$xoops->getHandlerGroupPermission()->deleteByModule($module_id, "category_read", $category->getVar('categoryid'));
$xoops->getHandlerGroupPermission()->deleteByModule($module_id, "item_submit", $category->getVar('categoryid'));
$xoops->getHandlerGroupPermission()->deleteByModule($module_id, "category_moderation", $category->getVar('categoryid'));
return true;
}
示例4: getItemsFromSearch
/**
* @param array $queryarray
* @param string $andor
* @param int $limit
* @param int $offset
* @param int $userid
* @param array $categories
* @param int $sortby
* @param string $searchin
* @param string $extra
*
* @return array
*/
public function getItemsFromSearch($queryarray = array(), $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = array(), $sortby = 0, $searchin = "", $extra = "")
{
$xoops = Xoops::getInstance();
$ret = array();
$gperm_handler = $xoops->getHandlerGroupPermission();
$groups = $xoops->getUserGroups();
$searchin = empty($searchin) ? array("title", "body", "summary") : (is_array($searchin) ? $searchin : array($searchin));
if (in_array("all", $searchin) || count($searchin) == 0) {
$searchin = array("title", "subtitle", "body", "summary", "meta_keywords");
}
if (is_array($userid) && count($userid) > 0) {
$userid = array_map("intval", $userid);
$criteriaUser = new CriteriaCompo();
$criteriaUser->add(new Criteria('uid', '(' . implode(',', $userid) . ')', 'IN'), 'OR');
} elseif (is_numeric($userid) && $userid > 0) {
$criteriaUser = new CriteriaCompo();
$criteriaUser->add(new Criteria('uid', $userid), 'OR');
}
$count = count($queryarray);
if (is_array($queryarray) && $count > 0) {
$criteriaKeywords = new CriteriaCompo();
for ($i = 0; $i < count($queryarray); ++$i) {
$criteriaKeyword = new CriteriaCompo();
if (in_array('title', $searchin)) {
$criteriaKeyword->add(new Criteria('title', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
}
if (in_array('subtitle', $searchin)) {
$criteriaKeyword->add(new Criteria('subtitle', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
}
if (in_array('body', $searchin)) {
$criteriaKeyword->add(new Criteria('body', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
}
if (in_array('summary', $searchin)) {
$criteriaKeyword->add(new Criteria('summary', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
}
if (in_array('meta_keywords', $searchin)) {
$criteriaKeyword->add(new Criteria('meta_keywords', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
}
$criteriaKeywords->add($criteriaKeyword, $andor);
unset($criteriaKeyword);
}
}
if (!PublisherUtils::IsUserAdmin() && count($categories) > 0) {
$criteriaPermissions = new CriteriaCompo();
// Categories for which user has access
$categoriesGranted = $gperm_handler->getItemIds('category_read', $groups, $this->publisher->getModule()->getVar('mid'));
if (count($categories) > 0) {
$categoriesGranted = array_intersect($categoriesGranted, $categories);
}
if (count($categoriesGranted) == 0) {
return $ret;
}
$grantedCategories = new Criteria('categoryid', "(" . implode(',', $categoriesGranted) . ")", 'IN');
$criteriaPermissions->add($grantedCategories, 'AND');
} elseif (count($categories) > 0) {
$criteriaPermissions = new CriteriaCompo();
$grantedCategories = new Criteria('categoryid', "(" . implode(',', $categories) . ")", 'IN');
$criteriaPermissions->add($grantedCategories, 'AND');
}
$criteriaItemsStatus = new CriteriaCompo();
$criteriaItemsStatus->add(new Criteria('status', _PUBLISHER_STATUS_PUBLISHED));
$criteria = new CriteriaCompo();
if (!empty($criteriaUser)) {
$criteria->add($criteriaUser, 'AND');
}
if (!empty($criteriaKeywords)) {
$criteria->add($criteriaKeywords, 'AND');
}
if (!empty($criteriaPermissions)) {
$criteria->add($criteriaPermissions);
}
if (!empty($criteriaItemsStatus)) {
$criteria->add($criteriaItemsStatus, 'AND');
}
$criteria->setLimit($limit);
$criteria->setStart($offset);
if (empty($sortby)) {
$sortby = "datesub";
}
$criteria->setSort($sortby);
$order = 'ASC';
if ($sortby === "datesub") {
$order = 'DESC';
}
$criteria->setOrder($order);
$ret = $this->getItemObjects($criteria);
return $ret;
//.........这里部分代码省略.........