本文整理汇总了PHP中notificationEvents函数的典型用法代码示例。如果您正苦于以下问题:PHP notificationEvents函数的具体用法?PHP notificationEvents怎么用?PHP notificationEvents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notificationEvents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: b_notification_show
/**
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
function b_notification_show()
{
$xoops = Xoops::getInstance();
$helper = Notifications::getInstance();
include_once $helper->path('include/notification_functions.php');
$helper->loadLanguage('main');
// Notification must be enabled, and user must be logged in
if (!$xoops->isUser() || !notificationEnabled('block')) {
return false;
// do not display block
}
$notification_handler = $helper->getHandlerNotification();
// Now build the a nested associative array of info to pass
// to the block template.
$block = array();
$categories = notificationSubscribableCategoryInfo();
if (empty($categories)) {
return false;
}
foreach ($categories as $category) {
$section['name'] = $category['name'];
$section['title'] = $category['title'];
$section['description'] = $category['description'];
$section['itemid'] = $category['item_id'];
$section['events'] = array();
$subscribed_events = $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoops->module->getVar('mid'), $xoops->user->getVar('uid'));
foreach (notificationEvents($category['name'], true) as $event) {
if (!empty($event['admin_only']) && !$xoops->user->isAdmin($xoops->module->getVar('mid'))) {
continue;
}
$subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
$section['events'][$event['name']] = array('name' => $event['name'], 'title' => $event['title'], 'caption' => $event['caption'], 'description' => $event['description'], 'subscribed' => $subscribed);
}
$block['categories'][$category['name']] = $section;
}
// Additional form data
$block['target_page'] = "notification_update.php";
// FIXME: better or more standardized way to do this?
$script_url = explode('/', $_SERVER['PHP_SELF']);
$script_name = $script_url[count($script_url) - 1];
$block['redirect_script'] = $script_name;
$block['submit_button'] = _MD_NOTIFICATIONS_UPDATENOW;
$block['notification_token'] = $xoops->security()->createToken();
return $block;
}
示例2: b_legacy_notification_show
function b_legacy_notification_show()
{
global $xoopsConfig, $xoopsUser, $xoopsModule;
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$root =& XCube_Root::getSingleton();
$root->mLanguageManager->loadPageTypeMessageCatalog('notification');
// Notification must be enabled, and user must be logged in
if (empty($xoopsUser) || !notificationEnabled('block')) {
return false;
// do not display block
}
$notification_handler =& xoops_gethandler('notification');
// Now build the a nested associative array of info to pass
// to the block template.
$block = array();
$categories =& notificationSubscribableCategoryInfo();
if (empty($categories)) {
return false;
}
foreach ($categories as $category) {
$section['name'] = $category['name'];
$section['title'] = $category['title'];
$section['description'] = $category['description'];
$section['itemid'] = $category['item_id'];
$section['events'] = array();
$subscribed_events =& $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'));
foreach (notificationEvents($category['name'], true) as $event) {
if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
continue;
}
$subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
$section['events'][$event['name']] = array('name' => $event['name'], 'title' => $event['title'], 'caption' => $event['caption'], 'description' => $event['description'], 'subscribed' => $subscribed);
}
$block['categories'][$category['name']] = $section;
}
// Additional form data
$block['target_page'] = "notification_update.php";
// FIXME: better or more standardized way to do this?
$script_url = explode('/', xoops_getenv('PHP_SELF'));
$script_name = $script_url[count($script_url) - 1];
$block['redirect_script'] = $script_name;
$block['submit_button'] = _NOT_UPDATENOW;
return $block;
}
示例3: array
$xoops_notification = array();
$xoops_notification['show'] = isset($xoopsModule) && is_object($xoopsUser) && notificationEnabled('inline') ? 1 : 0;
if ($xoops_notification['show']) {
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php';
$categories =& notificationSubscribableCategoryInfo();
$event_count = 0;
if (!empty($categories)) {
$notification_handler =& xoops_gethandler('notification');
foreach ($categories as $category) {
$section['name'] = $category['name'];
$section['title'] = $category['title'];
$section['description'] = $category['description'];
$section['itemid'] = $category['item_id'];
$section['events'] = array();
$subscribed_events = $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'));
foreach (notificationEvents($category['name'], true) as $event) {
if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
continue;
}
if (!empty($event['invisible'])) {
continue;
}
$subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
$section['events'][$event['name']] = array('name' => $event['name'], 'title' => $event['title'], 'caption' => $event['caption'], 'description' => $event['description'], 'subscribed' => $subscribed);
$event_count++;
}
$xoops_notification['categories'][$category['name']] = $section;
}
$xoops_notification['target_page'] = "notification_update.php";
$xoops_notification['redirect_script'] = xoops_getenv('PHP_SELF');
$xoopsTpl->assign(array('lang_activenotifications' => _NOT_ACTIVENOTIFICATIONS, 'lang_notificationoptions' => _NOT_NOTIFICATIONOPTIONS, 'lang_updateoptions' => _NOT_UPDATEOPTIONS, 'lang_updatenow' => _NOT_UPDATENOW, 'lang_category' => _NOT_CATEGORY, 'lang_event' => _NOT_EVENT, 'lang_events' => _NOT_EVENTS, 'lang_checkall' => _NOT_CHECKALL, 'lang_notificationmethodis' => _NOT_NOTIFICATIONMETHODIS, 'lang_change' => _NOT_CHANGE, 'editprofile_url' => XOOPS_URL . '/edituser.php?uid=' . $xoopsUser->getVar('uid')));
示例4: _loadNotificationPreferenceInfomations
function _loadNotificationPreferenceInfomations(&$modversion, &$collection)
{
if (isset($modversion['hasNotification']) && $modversion['hasNotification'] == true) {
require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$t_options = array();
$t_options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$t_options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$t_options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$t_options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
$notifyEnable = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $t_options);
$info =& $this->_createPreferenceInformation($notifyEnable);
$collection->add($info);
unset($info);
//
// FIXME: doesn't work when update module... can't read back the
// array of options properly... " changing to "
//
unset($t_options);
//
// Get the module object to get mid.
//
$handler =& xoops_gethandler('module');
$module =& $handler->getByDirname($this->_mDirname);
$t_options = array();
$t_categoryArr =& notificationCategoryInfo('', $module->get('mid'));
foreach ($t_categoryArr as $t_category) {
$t_eventArr =& notificationEvents($t_category['name'], false, $module->get('mid'));
foreach ($t_eventArr as $t_event) {
if (!empty($t_event['invisible'])) {
continue;
}
$t_optionName = $t_category['title'] . ' : ' . $t_event['title'];
$t_options[$t_optionName] = $t_category['name'] . '-' . $t_event['name'];
}
}
$notifyEvents = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($t_options), 'options' => $t_options);
$info =& $this->_createPreferenceInformation($notifyEvents);
$collection->add($info);
unset($info);
}
}
示例5: xoops_module_install
//.........这里部分代码省略.........
if ($module->getVar('hascomments') != 0) {
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)));
array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0));
}
} else {
if ($module->getVar('hascomments') != 0) {
$configs = array();
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
$configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN));
$configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0);
}
}
// RMV-NOTIFY
if ($module->getVar('hasnotification') != 0) {
if (empty($configs)) {
$configs = array();
}
// Main notification options
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$options = array();
$options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
//$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
$configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options);
// Event-specific notification options
// FIXME: doesn't work when update module... can't read back the array of options properly... " changing to "
$options = array();
$categories =& notificationCategoryInfo('', $module->getVar('mid'));
foreach ($categories as $category) {
$events =& notificationEvents($category['name'], false, $module->getVar('mid'));
foreach ($events as $event) {
if (!empty($event['invisible'])) {
continue;
}
$option_name = $category['title'] . ' : ' . $event['title'];
$option_value = $category['name'] . '-' . $event['name'];
$options[$option_name] = $option_value;
}
}
$configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options);
}
if ($configs != false) {
$msgs[] = 'Adding module config data...';
$config_handler =& xoops_gethandler('config');
$order = 0;
foreach ($configs as $config) {
$confobj =& $config_handler->createConfig();
$confobj->setVar('conf_modid', $newmid);
$confobj->setVar('conf_catid', 0);
$confobj->setVar('conf_name', $config['name']);
$confobj->setVar('conf_title', $config['title'], true);
$confobj->setVar('conf_desc', $config['description'], true);
$confobj->setVar('conf_formtype', $config['formtype']);
$confobj->setVar('conf_valuetype', $config['valuetype']);
$confobj->setConfValueForInput($config['default'], true);
//$confobj->setVar('conf_value', $config['default'], true);
$confobj->setVar('conf_order', $order);
$confop_msgs = '';
if (isset($config['options']) && is_array($config['options'])) {
foreach ($config['options'] as $key => $value) {
$confop =& $config_handler->createConfigOption();
$confop->setVar('confop_name', $key, true);
示例6: notificationEvents
/**
* Get associative array of info for the selected event in the selected
* category (for the selected module).
*
* @param string $category_name Notification category
* @param string $event_name Notification event
* @param int $module_id ID of the module (default current module)
* @return mixed
*/
function ¬ificationEventInfo($category_name, $event_name, $module_id = null)
{
$all_events =& notificationEvents($category_name, false, $module_id);
foreach ($all_events as $event) {
if ($event['name'] == $event_name) {
return $event;
}
}
return false;
}
示例7: b_system_notification_show
/**
* @return array|bool
*/
function b_system_notification_show()
{
global $xoopsConfig, $xoopsUser, $xoopsModule;
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php';
// Notification must be enabled, and user must be logged in
if (empty($xoopsUser) || !notificationEnabled('block')) {
return false;
// do not display block
}
$notification_handler = xoops_getHandler('notification');
// Now build the a nested associative array of info to pass
// to the block template.
$block = array();
$categories =& notificationSubscribableCategoryInfo();
if (empty($categories)) {
return false;
}
foreach ($categories as $category) {
$section['name'] = $category['name'];
$section['title'] = $category['title'];
$section['description'] = $category['description'];
$section['itemid'] = $category['item_id'];
$section['events'] = array();
$subscribed_events = $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->getVar('mid'), $xoopsUser->getVar('uid'));
foreach (notificationEvents($category['name'], true) as $event) {
if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
continue;
}
$subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
$section['events'][$event['name']] = array('name' => $event['name'], 'title' => $event['title'], 'caption' => $event['caption'], 'description' => $event['description'], 'subscribed' => $subscribed);
}
$block['categories'][$category['name']] = $section;
}
// Additional form data
$block['target_page'] = 'notification_update.php';
// FIXME: better or more standardized way to do this?
$script_url = explode('/', $_SERVER['PHP_SELF']);
$script_name = $script_url[count($script_url) - 1];
$block['redirect_script'] = $script_name;
$block['submit_button'] = _NOT_UPDATENOW;
$block['notification_token'] = $GLOBALS['xoopsSecurity']->createToken();
return $block;
}
示例8: array
/**
* Get & build config items from Manifesto by specific module object.
*/
function &getConfigInfosFromManifesto(&$module)
{
$configInfos = $module->getInfo('config');
//
// Insert comment config by old style.
//
if ($module->getVar('hascomments') != 0) {
require_once XOOPS_ROOT_PATH . "/include/comment_constants.php";
$configInfos[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN));
$configInfos[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0);
}
//
// Insert comment config by old style.
//
if ($module->get('hasnotification') != 0) {
require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$t_options = array();
$t_options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$t_options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$t_options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$t_options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
$configInfos[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $t_options);
//
// FIXME: doesn't work when update module... can't read back the
// array of options properly... " changing to "
//
unset($t_options);
$t_options = array();
$t_categoryArr =& notificationCategoryInfo('', $module->get('mid'));
foreach ($t_categoryArr as $t_category) {
$t_eventArr =& notificationEvents($t_category['name'], false, $module->get('mid'));
foreach ($t_eventArr as $t_event) {
if (!empty($t_event['invisible'])) {
continue;
}
$t_optionName = $t_category['title'] . ' : ' . $t_event['title'];
$t_options[$t_optionName] = $t_category['name'] . '-' . $t_event['name'];
}
}
$configInfos[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($t_options), 'options' => $t_options);
}
return $configInfos;
}
示例9: xoops_module_update
//.........这里部分代码省略.........
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)));
array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0));
}
} else {
if ($module->getVar('hascomments') != 0) {
$configs = array();
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
$configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN));
$configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0);
}
}
// RMV-NOTIFY
if ($module->getVar('hasnotification') != 0) {
if (empty($configs)) {
$configs = array();
}
// Main notification options
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$options = array();
$options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
//$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
$configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options);
// Event specific notification options
// FIXME: for some reason the default doesn't come up properly
// initially is ok, but not when 'update' module..
$options = array();
$categories =& notificationCategoryInfo('', $module->getVar('mid'));
foreach ($categories as $category) {
$events =& notificationEvents($category['name'], false, $module->getVar('mid'));
foreach ($events as $event) {
if (!empty($event['invisible'])) {
continue;
}
$option_name = $category['title'] . ' : ' . $event['title'];
$option_value = $category['name'] . '-' . $event['name'];
$options[$option_name] = $option_value;
//$configs[] = array ('name' => notificationGenerateConfig($category,$event,'name'), 'title' => notificationGenerateConfig($category,$event,'title_constant'), 'description' => notificationGenerateConfig($category,$event,'description_constant'), 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
}
}
$configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options);
}
if ($configs != false) {
$msgs[] = 'Adding module config data...';
$config_handler =& xoops_gethandler('config');
$order = 0;
foreach ($configs as $config) {
// only insert ones that have been deleted previously with success
if (!in_array($config['name'], $config_delng)) {
$confobj =& $config_handler->createConfig();
$confobj->setVar('conf_modid', $newmid);
$confobj->setVar('conf_catid', 0);
$confobj->setVar('conf_name', $config['name']);
$confobj->setVar('conf_title', $config['title'], true);
$confobj->setVar('conf_desc', $config['description'], true);
$confobj->setVar('conf_formtype', $config['formtype']);
$confobj->setVar('conf_valuetype', $config['valuetype']);
if (isset($config_old[$config['name']]['value']) && $config_old[$config['name']]['formtype'] == $config['formtype'] && $config_old[$config['name']]['valuetype'] == $config['valuetype']) {
// preserver the old value if any
// form type and value type must be the same
$confobj->setVar('conf_value', $config_old[$config['name']]['value'], true);
} else {
示例10: insertConfig
/**
* Insert configuration items
*
* @return void
*/
function insertConfig()
{
$configs = $this->getInfo('config');
if ($configs == false) {
$configs = array();
}
if ($this->getVar('hascomments') != 0) {
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)));
array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0));
}
// RMV-NOTIFY
if ($this->getVar('hasnotification') != 0) {
if (empty($configs)) {
$configs = array();
}
// Main notification options
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$options = array();
$options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
$configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options);
// Event-specific notification options
// FIXME: doesn't work when update module... can't read back the array of options properly... " changing to "
$options = array();
$categories =& notificationCategoryInfo('', $this->getVar('mid'));
foreach ($categories as $category) {
$events =& notificationEvents($category['name'], false, $this->getVar('mid'));
foreach ($events as $event) {
if (!empty($event['invisible'])) {
continue;
}
$option_name = $category['title'] . ' : ' . $event['title'];
$option_value = $category['name'] . '-' . $event['name'];
$options[$option_name] = $option_value;
}
}
$configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options);
}
if ($configs != false) {
$confcat_handler =& xoops_gethandler('configcategory');
/* @var $confcat_handler XoopsConfigCategoryHandler */
$confcats =& $confcat_handler->getCatByModule($this->getVar('mid'));
if (count($confcats) > 0) {
foreach (array_keys($confcats) as $i) {
//get categories by confcat_nameid
$cats[$confcats[$i]->getVar('confcat_nameid')] = $confcats[$i]->getVar('confcat_id');
}
}
$this->setMessage('Adding module config data...');
$config_handler =& xoops_gethandler('config');
$configcriteria = new Criteria('conf_modid', $this->getVar('mid'));
$old_configs =& $config_handler->getConfigs($configcriteria, false, true);
unset($configcriteria);
foreach ($configs as $config) {
$configs_name[] = $config["name"];
}
foreach (array_keys($old_configs) as $i) {
if (!in_array($old_configs[$i]->getVar('conf_name'), $configs_name)) {
$config_handler->deleteConfig($old_configs[$i]);
continue;
}
$conf_arr[$old_configs[$i]->getVar('conf_name')] =& $old_configs[$i];
}
$order = 0;
foreach ($configs as $config) {
if (isset($conf_arr[$config['name']])) {
$confobj =& $conf_arr[$config['name']];
} else {
$confobj =& $config_handler->createConfig();
}
$confcat_nameid = isset($config['category']) ? $config['category'] : 'xoops_default';
$confobj->setVar('conf_modid', $this->getVar('mid'));
$confobj->setVar('conf_catid', $cats[$confcat_nameid]);
$confobj->setVar('conf_name', $config['name']);
$confobj->setVar('conf_title', $config['title'], true);
$confobj->setVar('conf_desc', $config['description'], true);
$confobj->setVar('conf_formtype', $config['formtype']);
$confobj->setVar('conf_valuetype', $config['valuetype']);
//$confobj->setVar('conf_value', $config['default'], true);
$confobj->setVar('conf_order', $order);
if ($confobj->isNew()) {
// Only set configuration value to default on new configs
$confobj->setConfValueForInput($config['default'], true);
}
$confop_msgs = '';
if (isset($config['options']) && is_array($config['options'])) {
$options =& $confobj->getConfOptions();
if (count($options) > 0) {
foreach (array_keys($options) as $i) {
$existing_options[$options[$i]->getVar('confop_name')] = $options[$i]->getVar('confop_value');
}
//.........这里部分代码省略.........
示例11: notifications_select
/**
* This functions is add to 'Legacyfunction.Notifications.Select'.
*
* @param XCube_RenderBuffer $render
*/
function notifications_select(&$render)
{
require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
require_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$root =& XCube_Root::getSingleton();
$xoopsModule =& $root->mContext->mXoopsModule;
$moduleConfig =& $root->mContext->mModuleConfig;
$xoopsUser =& $root->mContext->mXoopsUser;
$xoops_notification = array();
$xoops_notification['show'] = is_object($xoopsModule) && is_object($xoopsUser) && notificationEnabled('inline') ? 1 : 0;
if ($xoops_notification['show']) {
$root->mLanguageManager->loadPageTypeMessageCatalog('notification');
$categories =& notificationSubscribableCategoryInfo();
$event_count = 0;
if (!empty($categories)) {
$notification_handler =& xoops_gethandler('notification');
foreach ($categories as $category) {
$section['name'] = $category['name'];
$section['title'] = $category['title'];
$section['description'] = $category['description'];
$section['itemid'] = $category['item_id'];
$section['events'] = array();
$subscribed_events =& $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->get('mid'), $xoopsUser->get('uid'));
foreach (notificationEvents($category['name'], true) as $event) {
if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
continue;
}
if (!empty($event['invisible'])) {
continue;
}
$subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0;
$section['events'][$event['name']] = array('name' => $event['name'], 'title' => $event['title'], 'caption' => $event['caption'], 'description' => $event['description'], 'subscribed' => $subscribed);
$event_count++;
}
$xoops_notification['categories'][$category['name']] = $section;
}
$xoops_notification['target_page'] = "notification_update.php";
$xoops_notification['redirect_script'] = xoops_getenv('PHP_SELF');
$render->setAttribute('editprofile_url', XOOPS_URL . '/edituser.php?uid=' . $xoopsUser->getShow('uid'));
switch ($xoopsUser->getVar('notify_method')) {
case XOOPS_NOTIFICATION_METHOD_DISABLE:
$render->setAttribute('user_method', _NOT_DISABLE);
break;
case XOOPS_NOTIFICATION_METHOD_PM:
$render->setAttribute('user_method', _NOT_PM);
break;
case XOOPS_NOTIFICATION_METHOD_EMAIL:
$render->setAttribute('user_method', _NOT_EMAIL);
break;
}
} else {
$xoops_notification['show'] = 0;
}
if ($event_count == 0) {
$xoops_notification['show'] = 0;
}
}
$render->setAttribute('xoops_notification', $xoops_notification);
}
示例12: xoops_module_install
//.........这里部分代码省略.........
if ($configs != false) {
if ($module->getVar('hascomments') != 0) {
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)));
array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0));
}
} else {
if ($module->getVar('hascomments') != 0) {
$configs = array();
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
$configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN));
$configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0);
}
}
// RMV-NOTIFY
if ($module->getVar('hasnotification') != 0) {
if (empty($configs)) {
$configs = array();
}
// Main notification options
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$options = array();
$options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
$configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options);
// Event-specific notification options
// FIXME: doesn't work when update module... can't read back the array of options properly... " changing to "
$options = array();
$categories =& notificationCategoryInfo('', $module->getVar('mid'));
foreach ($categories as $category) {
$events =& notificationEvents($category['name'], false, $module->getVar('mid'));
foreach ($events as $event) {
if (!empty($event['invisible'])) {
continue;
}
$option_name = $category['title'] . ' : ' . $event['title'];
$option_value = $category['name'] . '-' . $event['name'];
$options[$option_name] = $option_value;
}
unset($events);
}
unset($categories);
$configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options);
}
if ($configs != false) {
$msgs[] = _MD_AM_MODULE_DATA_ADD;
$config_handler =& xoops_gethandler('config');
$order = 0;
foreach ($configs as $config) {
$confobj =& $config_handler->createConfig();
$confobj->setVar('conf_modid', $newmid);
$confobj->setVar('conf_catid', 0);
$confobj->setVar('conf_name', $config['name']);
$confobj->setVar('conf_title', $config['title'], true);
$confobj->setVar('conf_desc', $config['description'], true);
$confobj->setVar('conf_formtype', $config['formtype']);
$confobj->setVar('conf_valuetype', $config['valuetype']);
$confobj->setConfValueForInput($config['default'], true);
$confobj->setVar('conf_order', $order);
$confop_msgs = '';
if (isset($config['options']) && is_array($config['options'])) {
foreach ($config['options'] as $key => $value) {
$confop =& $config_handler->createConfigOption();
示例13: array
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$options = array();
$options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
//$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
$configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options);
// Event specific notification options
// FIXME: for some reason the default doesn't come up properly
// initially is ok, but not when 'update' module..
$options = array();
$categories =& notificationCategoryInfo('', $module->getVar('mid'));
foreach ($categories as $category) {
$events =& notificationEvents($category['name'], false, $module->getVar('mid'));
foreach ($events as $event) {
if (!empty($event['invisible'])) {
continue;
}
$option_name = $category['title'] . ' : ' . $event['title'];
$option_value = $category['name'] . '-' . $event['name'];
$options[$option_name] = $option_value;
//$configs[] = array ('name' => notificationGenerateConfig($category,$event,'name'), 'title' => notificationGenerateConfig($category,$event,'title_constant'), 'description' => notificationGenerateConfig($category,$event,'description_constant'), 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
}
}
$configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options);
}
if ($configs != false) {
$msgs[] = 'Adding module config data...';
$config_handler =& xoops_gethandler('config');
示例14: xoops_module_update
//.........这里部分代码省略.........
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)));
array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0));
}
} else {
if ($module->getVar('hascomments') != 0) {
$configs = array();
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
$configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN));
$configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0);
}
}
// RMV-NOTIFY
if ($module->getVar('hasnotification') != 0) {
if (empty($configs)) {
$configs = array();
}
// Main notification options
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
$options = array();
$options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE;
$options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK;
$options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
$options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH;
//$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
$configs[] = array('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options);
// Event specific notification options
// FIXME: for some reason the default doesn't come up properly
// initially is ok, but not when 'update' module..
$options = array();
$categories =& notificationCategoryInfo('', $module->getVar('mid'));
foreach ($categories as $category) {
$events =& notificationEvents($category['name'], false, $module->getVar('mid'));
foreach ($events as $event) {
if (!empty($event['invisible'])) {
continue;
}
$option_name = $category['title'] . ' : ' . $event['title'];
$option_value = $category['name'] . '-' . $event['name'];
$options[$option_name] = $option_value;
//$configs[] = array ('name' => notificationGenerateConfig($category,$event,'name'), 'title' => notificationGenerateConfig($category,$event,'title_constant'), 'description' => notificationGenerateConfig($category,$event,'description_constant'), 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
}
}
$configs[] = array('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options);
}
if ($configs != false) {
$msgs[] = 'Adding module config data...';
$config_handler = xoops_getHandler('config');
$order = 0;
foreach ($configs as $config) {
// only insert ones that have been deleted previously with success
if (!in_array($config['name'], $config_delng)) {
$confobj = $config_handler->createConfig();
$confobj->setVar('conf_modid', $newmid);
$confobj->setVar('conf_catid', 0);
$confobj->setVar('conf_name', $config['name']);
$confobj->setVar('conf_title', $config['title'], true);
$confobj->setVar('conf_desc', $config['description'], true);
$confobj->setVar('conf_formtype', $config['formtype']);
if (isset($config['valuetype'])) {
$confobj->setVar('conf_valuetype', $config['valuetype']);
}
if (isset($config_old[$config['name']]['value']) && $config_old[$config['name']]['formtype'] == $config['formtype'] && $config_old[$config['name']]['valuetype'] == $config['valuetype']) {
// preserver the old value if any
// form type and value type must be the same
示例15: notificationEvents
/**
* Get associative array of info for the selected event in the selected
* category (for the selected module).
*
* @param string $category_name Notification category
* @param string $event_name Notification event
* @param int $module_id ID of the module (default current module)
* @return mixed
*/
function ¬ificationEventInfo($category_name, $event_name, $module_id = null)
{
$all_events =& notificationEvents($category_name, false, $module_id);
if (is_array($all_events)) {
foreach ($all_events as $event) {
if ($event['name'] == $event_name) {
return $event;
}
}
}
$ret = false;
return $ret;
}