本文整理汇总了PHP中CriteriaCompo类的典型用法代码示例。如果您正苦于以下问题:PHP CriteriaCompo类的具体用法?PHP CriteriaCompo怎么用?PHP CriteriaCompo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CriteriaCompo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_function_xoInboxCount
function smarty_function_xoInboxCount($params, &$smarty)
{
global $xoopsUser;
if (!isset($xoopsUser) || !is_object($xoopsUser)) {
return;
}
$time = time();
if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
$count = intval($_SESSION['xoops_inbox_count']);
} else {
$module_handler = xoops_gethandler('module');
$pm_module = $module_handler->getByDirname('pm');
if ($pm_module && $pm_module->getVar('isactive')) {
$pm_handler =& xoops_getModuleHandler('message', 'pm');
} else {
$pm_handler =& xoops_gethandler('privmessage');
}
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
$count = intval($pm_handler->getCount($criteria));
$_SESSION['xoops_inbox_count'] = $count;
$_SESSION['xoops_inbox_count_expire'] = $time + 60;
}
if (!@empty($params['assign'])) {
$smarty->assign($params['assign'], $count);
} else {
echo $count;
}
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:29,代码来源:function.xoInboxCount.php
示例2: getCategoryList
public function getCategoryList($uid = 0)
{
$criteria = new CriteriaCompo();
if (!empty($uid)) {
$criteria->add(new Criteria("uid", $uid));
}
$criteria->setOrder("ASC");
$criteria->setSort("cat_id");
$categories = $this->getAll($criteria);
$catarr = array();
if ($this->getCount($criteria)) {
unset($criteria);
$topic_handler = xoops_getmodulehandler("topics", "press");
$criteria = new CriteriaCompo(new Criteria("cat_id", "(" . implode(",", array_keys($categories)) . ")", "in"));
if (!empty($uid)) {
$criteria->add(new Criteria("uid", $uid));
}
$criteria->setGroupby("cat_id");
$counts = $topic_handler->getCounts($criteria);
foreach ($categories as $key => $obj) {
$catarr[$key]["cat_name"] = $obj->getVar("cat_name");
$catarr[$key]["cat_id"] = $key;
if (!empty($uid)) {
$catarr[$key]["uid"] = $uid;
}
$catarr[$key]["cat_topics"] = isset($counts[$key]) ? $counts[$key] : 0;
}
return $catarr;
}
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:30,代码来源:category.php
示例3: smarty_function_xoInboxCount
function smarty_function_xoInboxCount($params, &$smarty)
{
$xoops = Xoops::getInstance();
if (!$xoops->isUser()) {
return;
}
$time = time();
if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
$count = (int) $_SESSION['xoops_inbox_count'];
} else {
$pm_handler = $xoops->getHandlerPrivateMessage();
$xoopsPreload = XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoops->user->getVar('uid')));
$count = (int) $pm_handler->getCount($criteria);
$_SESSION['xoops_inbox_count'] = $count;
$_SESSION['xoops_inbox_count_expire'] = $time + 60;
}
if (!@empty($params['assign'])) {
$smarty->assign($params['assign'], $count);
} else {
echo $count;
}
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:25,代码来源:function.xoInboxCount.php
示例4: b_categories_list_show
function b_categories_list_show($options)
{
include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
$smartpartner_category_handler =& smartpartner_gethandler('category');
$criteria = new CriteriaCompo();
$criteria->setSort(isset($options[0]) ? $options[0] : 'name');
$criteria->setOrder(isset($options[1]) ? $options[1] : 'ASC');
$catsObj =& $smartpartner_category_handler->getobjects($criteria, true);
$catArray = get_content(0, $catsObj, $options[2]);
$block = array();
$block['categories'] = $catArray;
$block['displaysubs'] = $options[2];
if (isset($_GET['view_category_id'])) {
$current_id = $_GET['view_category_id'];
$block['current'] = $catsObj[$current_id]->getVar('parentid') == 0 ? $current_id : $catsObj[$current_id]->getVar('parentid');
} elseif (isset($_GET['id'])) {
$smartpartner_partner_handler =& smartpartner_gethandler('partner');
$partnerObj = $smartpartner_partner_handler->get($_GET['id']);
if (is_object($partnerObj)) {
$parent = $partnerObj->getVar('categoryid');
$block['current'] = $catsObj[$parent]->getVar('parentid') == 0 ? $parent : $catsObj[$parent]->getVar('parentid');
}
}
return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:25,代码来源:categories_list.php
示例5: _updatePassword
function _updatePassword(&$controller)
{
$this->mActionForm->fetch();
$userHandler =& xoops_gethandler('user');
$criteria = new CriteriaCompo(new Criteria('email', $this->mActionForm->get('email')));
$criteria->add(new Criteria('pass', $this->mActionForm->get('code'), '=', '', 'LEFT(%s, 5)'));
$lostUserArr =& $userHandler->getObjects($criteria);
if (is_array($lostUserArr) && count($lostUserArr) > 0) {
$lostUser =& $lostUserArr[0];
} else {
return USER_FRAME_VIEW_ERROR;
}
$newpass = xoops_makepass();
$extraVars['newpass'] = $newpass;
$builder = new User_LostPass2MailBuilder();
$director = new User_LostPassMailDirector($builder, $lostUser, $controller->mRoot->mContext->getXoopsConfig(), $extraVars);
$director->contruct();
$xoopsMailer =& $builder->getResult();
if (!$xoopsMailer->send()) {
// $xoopsMailer->getErrors();
return USER_FRAME_VIEW_ERROR;
}
$lostUser->set('pass', md5($newpass), true);
$userHandler->insert($lostUser, true);
return USER_FRAME_VIEW_SUCCESS;
}
开发者ID:nouphet,项目名称:rata,代码行数:26,代码来源:LostPassAction.class.php
示例6: xoops_module_update_ckeditor4
function xoops_module_update_ckeditor4()
{
$module_handler = xoops_gethandler('module');
$Module = $module_handler->getByDirname('ckeditor4');
$config_handler = xoops_gethandler('config');
$mid = $Module->mid();
$ModuleConfig = $config_handler->getConfigsByCat(0, $mid);
if (substr($ModuleConfig['toolbar_user'], -4) === '""]]') {
//fix typo '""]]' to '"]]' for version <= 0.37
$criteria = new CriteriaCompo(new Criteria('conf_modid', $mid));
$criteria->add(new Criteria('conf_catid', 0));
$criteria->add(new Criteria('conf_name', 'toolbar_user'));
if ($configs = $config_handler->_cHandler->getObjects($criteria)) {
$val = str_replace('""]]', '"]]', $ModuleConfig['toolbar_user']);
$configs[0]->setVar('conf_value', $val, true);
$config_handler->insertConfig($configs[0]);
}
}
if (preg_match('/^head\\s*$/m', $ModuleConfig['contentsCss'])) {
//fix typo 'head' to '<head>' for version <= 0.38
$criteria = new CriteriaCompo(new Criteria('conf_modid', $mid));
$criteria->add(new Criteria('conf_catid', 0));
$criteria->add(new Criteria('conf_name', 'contentsCss'));
if ($configs = $config_handler->_cHandler->getObjects($criteria)) {
$val = preg_replace('/^head(\\s*)$/m', '<head>$1', $ModuleConfig['contentsCss']);
$configs[0]->setVar('conf_value', $val, true);
$config_handler->insertConfig($configs[0]);
}
}
return true;
}
开发者ID:digideskio,项目名称:ckeditor4,代码行数:31,代码来源:onupdate.inc.php
示例7: getGrantedGroupsForIds
function getGrantedGroupsForIds($item_ids_array, $gperm_name = false)
{
static $groups;
if ($gperm_name) {
if (isset($groups[$gperm_name])) {
return $groups[$gperm_name];
}
} else {
// if !$gperm_name then we will fetch all permissions in the module so we don't need them again
return $groups;
}
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('gperm_modid', $this->mid));
if ($gperm_name) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
}
$objs = $this->getObjects($criteria);
foreach ($objs as $obj) {
$groups[$obj->getVar('gperm_name')][$obj->getVar('gperm_itemid')][] = $obj->getVar('gperm_groupid');
}
//Return the permission array
if ($gperm_name) {
return isset($groups[$gperm_name]) ? $groups[$gperm_name] : array();
} else {
return isset($groups) ? $groups : array();
}
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:27,代码来源:Permission.php
示例8: checkLogin
function checkLogin(&$xoopsUser)
{
$root =& XCube_Root::getSingleton();
if ($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
return;
}
$root->mLanguageManager->loadModuleMessageCatalog('user');
$userHandler =& xoops_getmodulehandler('users', 'user');
$criteria = new CriteriaCompo();
if (xoops_getrequest('uname') != "" && strpos(xoops_getrequest('uname'), '@') !== false) {
$criteria->add(new Criteria('email', xoops_getrequest('uname')));
} else {
$criteria->add(new Criteria('uname', xoops_getrequest('uname')));
// use for both e-mail or uname logiin
// $criteria->add(new Criteria('uname','')); // use for only e-mail logiin
}
$criteria->add(new Criteria('pass', md5(xoops_getrequest('pass'))));
$userArr =& $userHandler->getObjects($criteria);
if (count($userArr) != 1) {
return;
}
if ($userArr[0]->get('level') == 0) {
return;
}
$handler =& xoops_gethandler('user');
$user =& $handler->get($userArr[0]->get('uid'));
$xoopsUser = $user;
require_once XOOPS_ROOT_PATH . '/include/session.php';
xoops_session_regenerate();
$_SESSION = array();
$_SESSION['xoopsUserId'] = $xoopsUser->get('uid');
$_SESSION['xoopsUserGroups'] = $xoopsUser->getGroups();
}
开发者ID:nouphet,项目名称:rata,代码行数:33,代码来源:Emaillogin.class.php
示例9: executeViewIndex
function executeViewIndex(&$controller, &$xoopsUser, &$render)
{
$render->setTemplateName("blockinstall_list.html");
//
// Lazy load
//
foreach (array_keys($this->mObjects) as $key) {
$this->mObjects[$key]->loadModule();
}
$render->setAttribute("objects", $this->mObjects);
$render->setAttribute("pageNavi", $this->mFilter->mNavi);
$moduleHandler =& xoops_gethandler('module');
$modules =& $moduleHandler->getObjects(new Criteria('isactive', 1));
$render->setAttribute('modules', $modules);
$render->setAttribute('filterForm', $this->mFilter);
$render->setAttribute('pageArr', $this->mpageArr);
$block_handler =& $this->_getHandler();
$block_total = $block_handler->getCount();
$inactive_block_total = $block_handler->getCount(new Criteria('isactive', 0));
$active_block_total = $block_total - $inactive_block_total;
$render->setAttribute('BlockTotal', $block_total);
$render->setAttribute('ActiveBlockTotal', $active_block_total);
$render->setAttribute('InactiveBlockTotal', $inactive_block_total);
$active_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
$active_installed_criteria->add(new Criteria('isactive', 1));
$active_installed_block_total = $block_handler->getCount($active_installed_criteria);
$render->setAttribute('ActiveInstalledBlockTotal', $active_installed_block_total);
$render->setAttribute('ActiveUninstalledBlockTotal', $active_block_total - $active_installed_block_total);
$inactive_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
$inactive_installed_criteria->add(new Criteria('isactive', 0));
$inactive_installed_block_total = $block_handler->getCount($inactive_installed_criteria);
$render->setAttribute('InactiveInstalledBlockTotal', $inactive_installed_block_total);
$render->setAttribute('InactiveUninstalledBlockTotal', $inactive_block_total - $inactive_installed_block_total);
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:34,代码来源:BlockInstallListAction.class.php
示例10: getTabTitle
function getTabTitle()
{
$title = $this->getVar('tabtitle');
// PM detection and conversion
if (preg_match('/{pm_new}/i', $title) || preg_match('/{pm_readed}/i', $title) || preg_match('/{pm_total}/i', $title)) {
if (is_object($GLOBALS['xoopsUser'])) {
$new_messages = 0;
$old_messages = 0;
$som = 0;
$user_id = 0;
$user_id = $GLOBALS['xoopsUser']->getVar('uid');
$pm_handler =& xoops_gethandler('privmessage');
$criteria_new = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria_new->add(new Criteria('to_userid', $GLOBALS['xoopsUser']->getVar('uid')));
$new_messages = $pm_handler->getCount($criteria_new);
$criteria_old = new CriteriaCompo(new Criteria('read_msg', 1));
$criteria_old->add(new Criteria('to_userid', $GLOBALS['xoopsUser']->getVar('uid')));
$old_messages = $pm_handler->getCount($criteria_old);
$som = $old_messages + $new_messages;
if ($new_messages > 0) {
$title = preg_replace('/\\{pm_new\\}/', '(<span style="color: rgb(255, 0, 0); font-weight: bold;">' . $new_messages . '</span>)', $title);
}
if ($old_messages > 0) {
$title = preg_replace('/\\{pm_readed\\}/', '(<span style="color: rgb(255, 0, 0); font-weight: bold;">' . $old_messages . '</span>)', $title);
}
if ($old_messages > 0) {
$title = preg_replace('/\\{pm_total\\}/', '(<span style="color: rgb(255, 0, 0); font-weight: bold;">' . $som . '</span>)', $title);
}
}
$title = preg_replace('/\\{pm_new\\}/', '', $title);
$title = preg_replace('/\\{pm_readed\\}/', '', $title);
$title = preg_replace('/\\{pm_total\\}/', '', $title);
}
return trim($title);
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:35,代码来源:tab.php
示例11: userPosts
/**
* @param int $uid
*
* @return int
*/
public function userPosts($uid)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('content_status', 0, '!='));
$criteria->add(new Criteria('content_author', (int) $uid));
return \Xoops::getModuleHelper('page')->getContentHandler()->getCount($criteria);
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:12,代码来源:system.php
示例12: prepare
/**
* prepare
*
* @param void
*
* @return bool
**/
public function prepare()
{
parent::prepare();
// in case of NEW post
if ($this->mObject->isNew()) {
if ($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')) {
$this->mObject->set('uid', $this->mRoot->mContext->mXoopsUser->get('uid'));
}
$this->mObject->set('post_time', time());
$this->mObject->set('modified_time', time());
$this->mObject->set('uid_hidden', 0);
$this->mObject->set('poster_ip', addslashes(@$_SERVER['REMOTE_ADDR']));
$this->mObject->set('modifier_ip', addslashes(@$_SERVER['REMOTE_ADDR']));
// get pid --> is it response post?
$pid = (int) $this->mRoot->mContext->mRequest->getRequest('pid');
if (isset($pid) && $pid > 0) {
$this->mObject->set('pid', $pid);
$topic_id = (int) $this->mRoot->mContext->mRequest->getRequest('topic_id');
$mParentHandler =& $this->_getHandler();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('post_id', $pid));
$mGotObjects =& $mParentHandler->getObjects($criteria, true);
$this->mParentObj =& $mGotObjects[0];
// get parent object --> is it really response post?
if (is_object($this->mParentObj)) {
$this->mObject->set('topic_id', $this->mParentObj->get('topic_id'));
$this->mObject->set('subject', "Re: " . ltrim($this->mParentObj->get('subject'), 'Re: '));
$this->mObject->set('depth_in_tree', (int) $this->mParentObj->get('depth_in_tree') + 1);
}
}
//adump($pid,$topic_id);
//adump($this->mParentObj);
}
return true;
}
开发者ID:naao,项目名称:xcforum_proto,代码行数:42,代码来源:PostsEditAction.class.php
示例13: CriteriaCompo
function &getList($avatar_type = null, $avatar_display = null)
{
$criteria = new CriteriaCompo();
if (isset($avatar_type)) {
$avatar_type = ($avatar_type == 'C') ? 'C' : 'S';
$criteria->add(new Criteria('avatar_type', $avatar_type));
}
if (isset($avatar_display)) {
$criteria->add(new Criteria('avatar_display', intval($avatar_display)));
}
$avatars =& $this->getObjects($criteria, true);
$ret = array();
$ret[] = array(
'id' => 0,
'name' => _NONE,
'file' => 'blank.gif',
);
if(is_array($avatars)){
foreach ($avatars as $id => $obj) {
$ret[] = array(
'id' => $id,
'name' => $obj->getVar('avatar_name'),
'file' => $obj->getVar('avatar_file'),
);
}
}
return $ret;
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:28,代码来源:avatar.class.php
示例14: dispatch
function dispatch()
{
global $xoopsUser;
if($this->isGuest()){
redirect_header(XOOPS_URL, 2, _NOPERM);
}
$uid_from = $xoopsUser->getVar('uid');
$uid_to = $this->getIntRequest('uid', XSNS_REQUEST_GET);
$user_handler =& XsnsUserHandler::getInstance();
$user_to =& $user_handler->get($uid_to);
if(!is_object($user_to) || !$user_to->isFriend($uid_from)){
redirect_header(XOOPS_URL, 2, _NOPERM);
}
$criteria = new CriteriaCompo(new Criteria('uid_to', $uid_to));
$criteria->add(new Criteria('uid_from', $uid_from));
$intro_handler =& XsnsIntroductionHandler::getInstance();
$intro_obj_list =& $intro_handler->getObjects($criteria);
if(is_array($intro_obj_list) && count($intro_obj_list)>0){
$body = $intro_obj_list[0]->getVar('body', 'e');
}
else{
$body = "";
}
$this->context->setAttribute('uid_to', $uid_to);
$this->context->setAttribute('body', $body);
$this->context->setAttribute('user_menu', $user_to->getMypageMenu());
$this->context->setAttribute('user_name', $user_to->getVar('uname'));
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:31,代码来源:intro_addAction.php
示例15: makeKeywordCriteria
public static function makeKeywordCriteria(CriteriaCompo $cri, $dirname, $keywords, $andor = 'AND')
{
$handler = Legacy_Utils::getModuleHandler('definition', $dirname);
//keywords
$keywordArr = self::splitKeywords($keywords);
//definition
$cri->add(new Criteria('search_flag', 1));
$cri->add(new Criteria('field_type', array(Xcck_FieldType::STRING, Xcck_FieldType::TEXT, Xcck_FieldType::URI), 'IN'));
$defObjs = $handler->getObjects($cri);
foreach ($defObjs as $obj) {
$fieldList['field_name'][] = $obj->get('field_name');
$fieldList['field_type'][] = $obj->get('field_type');
}
//page
$cri = new CriteriaCompo();
foreach ($defObjs as $def) {
foreach ($keywordArr as $keyword) {
if (strtoupper($andor) === 'OR') {
$cri->add(new Criteria($def->get('field_name'), self::makeKeyword($keyword), 'LIKE'), 'OR');
} else {
$cri->add(new Criteria($def->get('field_name'), self::makeKeyword($keyword), 'LIKE'));
}
}
}
return $cri;
}
开发者ID:mambax7,项目名称:xcck,代码行数:26,代码来源:Search.class.php
示例16: alumniCategoryDisplayChildren
function alumniCategoryDisplayChildren($cid = 0, $categoryArray, $prefix = '', $order = '', &$class)
{
$xoops = Xoops::getInstance();
$moduleDirName = basename(dirname(__DIR__));
$prefix = $prefix . '<img src=\'' . XOOPS_URL . "/modules/{$moduleDirName}/images/arrow.gif'>";
foreach (array_keys($categoryArray) as $i) {
$cid = $categoryArray[$i]->getVar('cid');
$pid = $categoryArray[$i]->getVar('pid');
$title = $categoryArray[$i]->getVar('title');
$img = $categoryArray[$i]->getVar('img');
$order = $categoryArray[$i]->getVar('ordre');
echo '<tr class="' . $class . '">';
echo '<td align="left">' . $prefix . ' ' . $categoryArray[$i]->getVar('title') . '</td>';
echo '<td align="center"><img src="' . XOOPS_URL . "/modules/{$moduleDirName}/images/cat/" . $categoryArray[$i]->getVar('img') . '" height="16px" title="img" alt="img"></td>';
echo '<td align="center">' . $categoryArray[$i]->getVar('ordre') . '</td>';
echo "<td align='center' width='10%'>\n\t\t\t\t\t\t<a href='category.php?op=edit_category&cid=" . $categoryArray[$i]->getVar('cid') . "'><img src='../images/edit.gif' alt='" . XoopsLocale::A_EDIT . "' title='" . XoopsLocale::A_EDIT . "'></a>\n\t\t\t\t\t\t<a href='category.php?op=delete_category&cid=" . $categoryArray[$i]->getVar('cid') . "'><img src='../images/dele.gif' alt='" . XoopsLocale::A_DELETE . "' title='" . XoopsLocale::A_DELETE . "'></a></td></tr>";
$class = $class == "even" ? "odd" : "even";
$categoriesHandler = $xoops->getModuleHandler('category', 'alumni');
$criteria2 = new CriteriaCompo();
$criteria2->add(new Criteria('pid', $categoryArray[$i]->getVar('cid')));
$criteria2->setSort('title');
$criteria2->setOrder('ASC');
$cat_pid = $categoriesHandler->getAll($criteria2);
$num_pid = $categoriesHandler->getCount();
if ($num_pid != 0) {
alumniCategoryDisplayChildren($cid, $cat_pid, $prefix, $order, $class);
}
}
}
开发者ID:jlm69,项目名称:alumni-26x,代码行数:29,代码来源:category.php
示例17: smarty_function_xoInboxCount
/**
* @param $params
* @param $smarty
*/
function smarty_function_xoInboxCount($params, &$smarty)
{
global $xoopsUser;
if (!isset($xoopsUser) || !is_object($xoopsUser)) {
return;
}
$time = time();
if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
$count = intval($_SESSION['xoops_inbox_count']);
} else {
$pm_handler =& xoops_gethandler('privmessage');
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
$count = intval($pm_handler->getCount($criteria));
$_SESSION['xoops_inbox_count'] = $count;
$_SESSION['xoops_inbox_count_expire'] = $time + 60;
}
if (!@empty($params['assign'])) {
$smarty->assign($params['assign'], $count);
} else {
echo $count;
}
}
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:29,代码来源:function.xoInboxCount.php
示例18: xoops_module_update_smartsection
function xoops_module_update_smartsection($module)
{
// Load SmartDbUpdater from the SmartObject Framework if present
$smartdbupdater = XOOPS_ROOT_PATH . "/modules/smartsection/class/smartdbupdater.php";
include_once $smartdbupdater;
$dbupdater = new SmartobjectDbupdater();
ob_start();
echo "<code>" . _SDU_UPDATE_UPDATING_DATABASE . "<br />";
// Adding partial_view field
$table = new SmartDbTable('smartsection_items');
if (!$table->fieldExists('partial_view')) {
$table->addNewField('partial_view', "varchar(255) NOT NULL default ''");
} else {
$table->addAlteredField('partial_view', "varchar(255) NOT NULL default ''");
}
if (!$dbupdater->updateTable($table)) {
/**
* @todo trap the errors
*/
}
unset($table);
/**
* Check for items with categoryid=0
*/
@($smartsection_item_handler = xoops_getmodulehandler('item', 'smartsection'));
@($smartsection_category_handler = xoops_getmodulehandler('category', 'smartsection'));
if ($smartsection_item_handler) {
//find a valid categoryid
$categoriesObj = $smartsection_category_handler->getCategories(1, 0, 0, 'weight', 'ASC', false);
if (count($categoriesObj) > 0) {
$categoryid = $categoriesObj[0]->getVar('categoryid');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('categoryid', 0));
$smartsection_item_handler->updateAll('categoryid', $categoryid, $criteria);
echo " Cleaning up items for with categoryid=0<br />";
}
}
// Adding item_tag field in smartsection_items
$table = new SmartDbTable('smartsection_items');
if (!$table->fieldExists('item_tag')) {
$table->addNewField('item_tag', "TEXT NOT NULL");
}
if ($table->fieldExists('tags')) {
$table->addDropedField('tags');
}
if (!$dbupdater->updateTable($table)) {
/**
* @todo trap the errors
*/
}
unset($table);
echo "</code>";
$feedback = ob_get_clean();
if (method_exists($module, "setMessage")) {
$module->setMessage($feedback);
} else {
echo $feedback;
}
return true;
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:60,代码来源:update.php
示例19: CriteriaCompo
function &getModule()
{
global $xoopsUser;
$ret = NULL;
if(empty($this->module_dirname) || empty($this->user_blog_url)){
return $ret;
}
$criteria = new CriteriaCompo(new Criteria('hassearch', 1));
$criteria->add(new Criteria('isactive', 1));
$criteria->add(new Criteria('dirname', $this->module_dirname));
$module_handler =& xoops_gethandler('module');
$blog_module_list =& $module_handler->getList($criteria);
if(count($blog_module_list) != 1){
return $ret;
}
$blog_module =& $module_handler->getByDirName($this->module_dirname);
if(!is_object($blog_module) || strtolower(get_class($blog_module))!='xoopsmodule'){
return $ret;
}
$gperm_handler =& xoops_gethandler('groupperm');
$groups = is_object($xoopsUser)? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
if($gperm_handler->checkRight('module_read', $blog_module->getVar('mid'), $groups)) {
$ret =& $blog_module;
}
return $ret;
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:31,代码来源:blog_module.php
示例20: links_block_edit
function links_block_edit($options)
{
include_once XOOPS_ROOT_PATH . "/modules/links/include/xoopsformloader.php";
$form = new XoopsBlockForm("", "", "");
$categories = new XoopsFormSelect(_MB_LINKS_SHOWCAT, 'options[0]', $options[0]);
$categories->addOption(0, _MB_LINKS_ALL);
$cat_handler = xoops_getmodulehandler('category', 'links');
$criteria = new CriteriaCompo();
$criteria->setSort('cat_order');
$criteria->setOrder('ASC');
$category = $cat_handler->getList($criteria);
foreach ($cat_handler->getList($criteria) as $k => $v) {
$categories->addOption($k, $v);
}
$form->addElement($categories, true);
$sort = new XoopsFormSelect(_MB_LINKS_SORTWAY, 'options[1]', $options[1]);
$sort->addOption('published', _MB_LINKS_PUBLISHTIME);
$sort->addOption('datetime', _MB_LINKS_UPDATETIME);
$sort->addOption('link_order', _MB_LINKS_DEFAULT);
$form->addElement($sort, true);
$form->addElement(new XoopsFormText(_MB_LINKS_SHOWHOWLIK, "options[2]", 5, 2, $options[2]), true);
$form->addElement(new XoopsFormText(_MB_LINKS_LIKTITLEMAX, "options[3]", 5, 2, $options[3]), true);
$form->addElement(new XoopsFormRadioYN(_MB_LINKS_SHOWCATTITLE, 'options[4]', $options[4]), true);
$display = new XoopsFormSelect(_MB_LINKS_BYSHOW, 'options[5]', $options[5]);
$display->addOption('1', _MB_LINKS_LOGOHOR);
$display->addOption('2', _MB_LINKS_LOGOVER);
$display->addOption('3', _MB_LINKS_TITLEHOR);
$display->addOption('4', _MB_LINKS_TITLEVER);
$form->addElement($display, true);
return $form->render();
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:blocks.php
注:本文中的CriteriaCompo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论