当前位置: 首页>>代码示例>>PHP>>正文


PHP notificationCategoryInfo函数代码示例

本文整理汇总了PHP中notificationCategoryInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP notificationCategoryInfo函数的具体用法?PHP notificationCategoryInfo怎么用?PHP notificationCategoryInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了notificationCategoryInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: triggerEvent

 function triggerEvent($category, $item_id, $event, $extra_tags = array(), $user_list = array(), $module_id = null, $omit_user_id = null)
 {
     if (!isset($module_id)) {
         global $xoopsModule;
         $module =& $xoopsModule;
         $module_id = !empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0;
     } else {
         $module_handler = xoops_gethandler('module');
         $module =& $module_handler->get($module_id);
     }
     // Get Config Array form xoops_version.php
     $not_config = $module->getInfo('notification');
     //
     $event_correct = false;
     foreach ($not_config['event'] as $event_config) {
         if ($event_config['name'] == $event && $event_config['category'] == $category) {
             $event_correct = true;
             break;
         }
     }
     // RaiseEvent 'XoopsNotificationHandler.Trigger' ('Legacy.Notify.Trigger')
     //  Delegate may hanldle notified event
     //  varArgs :
     //      'category'     [I] : Paramater $category of triggerEvent()
     //      'event'        [I] : Paramater $event of triggerEvent()
     //      'itemId'       [I] : Paramater $item_id of triggerEvent()
     //      'extraTags'    [I] : Paramater $extra_tags of triggerEvent()
     //      'userList'     [I] : Paramater $user_list of triggerEvent()
     //      'omitUid'      [I] : Paramater $omit_user_id of triggerEvent()
     //      'module'       [I] : Paramater $module_id of triggerEvent() , or currenr $xoopsModule
     //      'eventConfig'  [I] : $modversion['notification'] Array , defined in xoops_version.php
     //      'force_return' [O] : If force return this triggerEvents method, set it True
     //
     if ($event_correct) {
         /*
         			$varArgs  = array('category' => $category,
         							'event' => $event,
         							'itemId' => $item_id,
         							'extraTags' => $extra_tags,
         							'module' => &$module,
         							'userList' => $user_list,
         							'omitUid' => $omit_user_id,
         							'eventConfig' => $not_config,
         							'force_return' => false,
         						);*/
         $force_return = false;
         $this->mTriggerPreAction->call(new XCube_Ref($category), new XCube_Ref($event), new XCube_Ref($item_id), new XCube_Ref($extra_tags), new XCube_Ref($module), new XCube_Ref($user_list), new XCube_Ref($omit_user_id), new XCube_Ref($not_config), new XCube_Ref($force_return));
         $this->mTrigger->call($category, $event, $item_id, $extra_tags, new XCube_Ref($module), $user_list, $omit_user_id, $not_config, new XCube_Ref($force_return));
         if ($force_return) {
             return;
         }
     }
     // Check if event is enabled
     $config_handler = xoops_gethandler('config');
     $mod_config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
     if (empty($mod_config['notification_enabled'])) {
         return false;
     }
     $category_info =& notificationCategoryInfo($category, $module_id);
     $event_info =& notificationEventInfo($category, $event, $module_id);
     if (!in_array(notificationGenerateConfig($category_info, $event_info, 'option_name'), $mod_config['notification_events']) && empty($event_info['invisible'])) {
         return false;
     }
     if (!isset($omit_user_id)) {
         global $xoopsUser;
         if (!empty($xoopsUser)) {
             $omit_user_id = $xoopsUser->getVar('uid');
         } else {
             $omit_user_id = 0;
         }
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('not_modid', (int) $module_id));
     $criteria->add(new Criteria('not_category', $this->_escapeValue($category)));
     $criteria->add(new Criteria('not_itemid', (int) $item_id));
     $criteria->add(new Criteria('not_event', $this->_escapeValue($event)));
     $mode_criteria = new CriteriaCompo();
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDALWAYS), 'OR');
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE), 'OR');
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT), 'OR');
     $criteria->add($mode_criteria);
     if (!empty($user_list)) {
         $user_criteria = new CriteriaCompo();
         foreach ($user_list as $user) {
             $user_criteria->add(new Criteria('not_uid', $user), 'OR');
         }
         $criteria->add($user_criteria);
     }
     $notifications =& $this->getObjects($criteria);
     if (empty($notifications)) {
         return;
     }
     // Add some tag substitutions here
     $tags = array();
     if (!empty($not_config)) {
         if (!empty($not_config['tags_file'])) {
             $tags_file = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['tags_file'];
             if (file_exists($tags_file)) {
                 include_once $tags_file;
                 if (!empty($not_config['tags_func'])) {
//.........这里部分代码省略.........
开发者ID:nunoluciano,项目名称:uxcl,代码行数:101,代码来源:notification.php

示例2: xoops_module_install


//.........这里部分代码省略.........
                $configs = $module->getInfo('config');
                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_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) {
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:67,代码来源:modulesadmin.php

示例3: _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);
     }
 }
开发者ID:hiro1173,项目名称:legacy,代码行数:42,代码来源:ModuleInstallInformation.class.php

示例4: 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;
 }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:47,代码来源:ModuleInstallUtils.class.php

示例5: notificationCategoryInfo

/**
 * Get an array of associative info arrays for subscribable categories
 * for the selected module.
 *
 * @param  int  $module_id  ID of the module
 * @return mixed
 */
function &notificationSubscribableCategoryInfo($module_id = null)
{
    $all_categories =& notificationCategoryInfo('', $module_id);
    // FIXME: better or more standardized way to do this?
    $script_url = explode('/', $_SERVER['PHP_SELF']);
    $script_name = $script_url[count($script_url) - 1];
    $sub_categories = array();
    foreach ($all_categories as $category) {
        // Check the script name
        $subscribe_from = $category['subscribe_from'];
        if (!is_array($subscribe_from)) {
            if ($subscribe_from == '*') {
                $subscribe_from = array($script_name);
                // FIXME: this is just a hack: force a match
            } else {
                $subscribe_from = array($subscribe_from);
            }
        }
        if (!in_array($script_name, $subscribe_from)) {
            continue;
        }
        // If 'item_name' is missing, automatic match.  Otherwise
        // check if that argument exists...
        if (empty($category['item_name'])) {
            $category['item_name'] = '';
            $category['item_id'] = 0;
            $sub_categories[] = $category;
        } else {
            $item_name = $category['item_name'];
            $id = $item_name != '' && isset($_GET[$item_name]) ? intval($_GET[$item_name]) : 0;
            if ($id > 0) {
                $category['item_id'] = $id;
                $sub_categories[] = $category;
            }
        }
    }
    return $sub_categories;
}
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:45,代码来源:notification_functions.php

示例6: triggerEvent

 function triggerEvent($mydirname, $mytrustdirname, $category, $item_id, $event, $extra_tags = array(), $user_list = array(), $omit_user_id = null)
 {
     $module_hanlder =& xoops_gethandler('module');
     $module =& $module_hanlder->getByDirname($mydirname);
     $notification_handler =& xoops_gethandler('notification');
     $mail_template_dir = $this->getMailTemplateDir($mydirname, $mytrustdirname);
     // calling a delegate before
     if (class_exists('XCube_DelegateUtils')) {
         $force_return = false;
         XCube_DelegateUtils::raiseEvent('D3NotificationHandler.Trigger', new XCube_Ref($category), new XCube_Ref($event), new XCube_Ref($item_id), new XCube_Ref($extra_tags), new XCube_Ref($module), new XCube_Ref($user_list), new XCube_Ref($omit_user_id), $module->getInfo('notification'), new XCube_Ref($force_return), new XCube_Ref($mail_template_dir), $mydirname, $mytrustdirname);
         if ($force_return) {
             return;
         }
     }
     $mid = $module->getVar('mid');
     // Check if event is enabled
     $config_handler =& xoops_gethandler('config');
     $mod_config =& $config_handler->getConfigsByCat(0, $mid);
     if (empty($mod_config['notification_enabled'])) {
         return false;
     }
     $category_info =& notificationCategoryInfo($category, $mid);
     $event_info =& notificationEventInfo($category, $event, $mid);
     if (!in_array(notificationGenerateConfig($category_info, $event_info, 'option_name'), $mod_config['notification_events']) && empty($event_info['invisible'])) {
         return false;
     }
     if (!isset($omit_user_id)) {
         global $xoopsUser;
         if (!empty($xoopsUser)) {
             $omit_user_id = $xoopsUser->getVar('uid');
         } else {
             $omit_user_id = 0;
         }
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('not_modid', intval($mid)));
     $criteria->add(new Criteria('not_category', $category));
     $criteria->add(new Criteria('not_itemid', intval($item_id)));
     $criteria->add(new Criteria('not_event', $event));
     $mode_criteria = new CriteriaCompo();
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDALWAYS), 'OR');
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE), 'OR');
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT), 'OR');
     $criteria->add($mode_criteria);
     if (!empty($user_list)) {
         $user_criteria = new CriteriaCompo();
         foreach ($user_list as $user) {
             $user_criteria->add(new Criteria('not_uid', $user), 'OR');
         }
         $criteria->add($user_criteria);
     }
     $notifications =& $notification_handler->getObjects($criteria);
     if (empty($notifications)) {
         return;
     }
     // Add some tag substitutions here
     $tags = array();
     // {X_ITEM_NAME} {X_ITEM_URL} {X_ITEM_TYPE} from lookup_func are disabled
     $tags['X_MODULE'] = $module->getVar('name', 'n');
     $tags['X_MODULE_URL'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/';
     $tags['X_NOTIFY_CATEGORY'] = $category;
     $tags['X_NOTIFY_EVENT'] = $event;
     $template = $event_info['mail_template'] . '.tpl';
     $subject = $event_info['mail_subject'];
     foreach ($notifications as $notification) {
         if (empty($omit_user_id) || $notification->getVar('not_uid') != $omit_user_id) {
             // user-specific tags
             //$tags['X_UNSUBSCRIBE_URL'] = 'TODO';
             // TODO: don't show unsubscribe link if it is 'one-time' ??
             $tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL . '/notifications.php';
             $tags = array_merge($tags, $extra_tags);
             $notification->notifyUser($mail_template_dir, $template, $subject, $tags);
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:75,代码来源:D3NotificationHandler.class.php

示例7: notificationCategoryInfo

/**
 * Get an array of associative info arrays for subscribable categories
 * for the selected module.
 *
 * @param  int  $module_id  ID of the module
 * @return mixed
 */
function &notificationSubscribableCategoryInfo($module_id = null)
{
    $all_categories =& notificationCategoryInfo('', $module_id);
    // FIXME: better or more standardized way to do this?
    $script_url = explode('/', $_SERVER['SCRIPT_NAME']);
    $script_name = $script_url[count($script_url) - 1];
    $sub_categories = array();
    foreach ($all_categories as $category) {
        // Check the script name
        $subscribe_from = $category['subscribe_from'];
        if (!is_array($subscribe_from)) {
            if ($subscribe_from == '*') {
                $subscribe_from = array($script_name);
                // FIXME: this is just a hack: force a match
            } else {
                $subscribe_from = array($subscribe_from);
            }
        }
        if (!in_array($script_name, $subscribe_from)) {
            continue;
        }
        // If 'item_name' is missing, automatic match.  Otherwise
        // check if that argument exists...
        if (empty($category['item_name'])) {
            $category['item_name'] = '';
            $category['item_id'] = 0;
            $sub_categories[] = $category;
        } else {
            $item_name = $category['item_name'];
            global $HTTP_GET_VARS;
            $id = $item_name != '' && isset($HTTP_GET_VARS[$item_name]) ? intval($HTTP_GET_VARS[$item_name]) : 0;
            if ($id > 0) {
                $category['item_id'] = $id;
                $sub_categories[] = $category;
            }
        }
    }
    // TODO: switch to $_GET instead of $HTTP_GET_VARS.  But also
    // in wiki need to switch, because we are SETTING the get vars
    // so we have the itemid always present even on default homepage
    return $sub_categories;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:49,代码来源:notification_functions.php

示例8: getDefaultView

 function getDefaultView(&$contoller, &$xoopsUser)
 {
     $criteria = new Criteria('not_uid', $xoopsUser->get('uid'));
     $criteria->setSort('not_modid, not_category, not_itemid');
     $handler =& xoops_gethandler('notification');
     $notificationArr =& $handler->getObjects($criteria);
     $moduleHandler =& xoops_gethandler('module');
     $prev_modid = -1;
     $prev_category = -1;
     $prev_item = -1;
     foreach ($notificationArr as $notify) {
         $t_modid = $notify->get('not_modid');
         $module =& $moduleHandler->get($t_modid);
         if (!is_object($module)) {
             continue;
         }
         if ($t_modid != $prev_modid) {
             $prev_modid = $t_modid;
             $prev_category = -1;
             $prev_item = -1;
             $this->mModules[$t_modid] = array('id' => $t_modid, 'name' => $module->getShow('name'), 'categories' => array());
             //
             // [ToDo] (Original)
             // note, we could auto-generate the url from the id
             // and category info... (except when category has multiple
             // subscription scripts defined...)
             // OR, add one more option to xoops_version 'view_from'
             // which tells us where to redirect... BUT, e.g. forums, it
             // still wouldn't give us all the required info... e.g. the
             // topic ID doesn't give us the ID of the forum which is
             // a required argument...
             //
             // Get the lookup function, if exists
             //
             $notifyConfig = $module->getInfo('notification');
             $lookupFunc = '';
             if (!empty($notifyConfig['lookup_file'])) {
                 $t_filepath = XOOPS_ROOT_PATH . '/modules/' . $module->get('dirname') . '/' . $notifyConfig['lookup_file'];
                 if (file_exists($t_filepath)) {
                     require_once $t_filepath;
                     if (!empty($notifyConfig['lookup_func']) && function_exists($notifyConfig['lookup_func'])) {
                         $lookupFunc = $notifyConfig['lookup_func'];
                     }
                 }
             }
         }
         $t_category = $notify->get('not_category');
         if ($t_category != $prev_category) {
             $prev_category = $t_category;
             $prev_item = -1;
             $categoryInfo =& notificationCategoryInfo($t_category, $t_modid);
         }
         $t_item = $notify->get('not_itemid');
         if ($t_item != $prev_item) {
             $prev_item = $t_item;
             if (!empty($lookupFunc)) {
                 $itemInfo = $lookupFunc($t_category, $t_item);
             } else {
                 $itemInfo = array('name' => '[' . _NOT_NAMENOTAVAILABLE . ']', 'url' => '');
             }
             $this->mModules[$t_modid]['categories'][$t_category]['items'][$t_item] = array('id' => $t_item, 'name' => $itemInfo['name'], 'url' => $itemInfo['url'], 'notifications' => array());
         }
         $eventInfo =& notificationEventInfo($t_category, $notify->get('not_event'), $notify->get('not_modid'));
         $this->mModules[$t_modid]['categories'][$t_category]['items'][$t_item]['notifications'][] = array('id' => $notify->get('not_id'), 'module_id' => $notify->get('not_modid'), 'category' => $notify->get('not_category'), 'category_title' => $categoryInfo['title'], 'item_id' => $notify->get('not_itemid'), 'event' => $notify->get('not_event'), 'event_title' => $eventInfo['title'], 'user_id' => $notify->get('not_uid'));
     }
     return LEGACY_FRAME_VIEW_INDEX;
 }
开发者ID:nouphet,项目名称:rata,代码行数:67,代码来源:NotifyListAction.class.php

示例9: 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');
                     }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:101,代码来源:module.php

示例10: triggerEvent

 function triggerEvent($category, $item_id, $event, $extra_tags = array(), $user_list = array(), $module_id = null, $omit_user_id = null)
 {
     if (!isset($module_id)) {
         global $xoopsModule;
         $module =& $xoopsModule;
         $module_id = !empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0;
     } else {
         $module_handler =& xoops_gethandler('module');
         $module =& $module_handler->get($module_id);
     }
     // Check if event is enabled
     $config_handler =& xoops_gethandler('config');
     $mod_config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
     if (empty($mod_config['notification_enabled'])) {
         return false;
     }
     $category_info =& notificationCategoryInfo($category, $module_id);
     $event_info =& notificationEventInfo($category, $event, $module_id);
     if (!in_array(notificationGenerateConfig($category_info, $event_info, 'option_name'), $mod_config['notification_events']) && empty($event_info['invisible'])) {
         return false;
     }
     if (!isset($omit_user_id)) {
         global $xoopsUser;
         if (!empty($xoopsUser)) {
             $omit_user_id = $xoopsUser->getVar('uid');
         } else {
             $omit_user_id = 0;
         }
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('not_modid', intval($module_id)));
     $criteria->add(new Criteria('not_category', $category));
     $criteria->add(new Criteria('not_itemid', intval($item_id)));
     $criteria->add(new Criteria('not_event', $event));
     $mode_criteria = new CriteriaCompo();
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDALWAYS), 'OR');
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE), 'OR');
     $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT), 'OR');
     $criteria->add($mode_criteria);
     if (!empty($user_list)) {
         $user_criteria = new CriteriaCompo();
         foreach ($user_list as $user) {
             $user_criteria->add(new Criteria('not_uid', $user), 'OR');
         }
         $criteria->add($user_criteria);
     }
     $notifications =& $this->getObjects($criteria);
     if (empty($notifications)) {
         return;
     }
     // Add some tag substitutions here
     $not_config = $module->getInfo('notification');
     $tags = array();
     if (!empty($not_config)) {
         if (!empty($not_config['tags_file'])) {
             $tags_file = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['tags_file'];
             if (file_exists($tags_file)) {
                 include_once $tags_file;
                 if (!empty($not_config['tags_func'])) {
                     $tags_func = $not_config['tags_func'];
                     if (function_exists($tags_func)) {
                         $tags = $tags_func($category, intval($item_id), $event);
                     }
                 }
             }
         }
         // RMV-NEW
         if (!empty($not_config['lookup_file'])) {
             $lookup_file = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['lookup_file'];
             if (file_exists($lookup_file)) {
                 include_once $lookup_file;
                 if (!empty($not_config['lookup_func'])) {
                     $lookup_func = $not_config['lookup_func'];
                     if (function_exists($lookup_func)) {
                         $item_info = $lookup_func($category, intval($item_id));
                     }
                 }
             }
         }
     }
     $tags['X_ITEM_NAME'] = !empty($item_info['name']) ? $item_info['name'] : '[' . _NOT_ITEMNAMENOTAVAILABLE . ']';
     $tags['X_ITEM_URL'] = !empty($item_info['url']) ? $item_info['url'] : '[' . _NOT_ITEMURLNOTAVAILABLE . ']';
     $tags['X_ITEM_TYPE'] = !empty($category_info['item_name']) ? $category_info['title'] : '[' . _NOT_ITEMTYPENOTAVAILABLE . ']';
     $tags['X_MODULE'] = $module->getVar('name');
     $tags['X_MODULE_URL'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/';
     $tags['X_NOTIFY_CATEGORY'] = $category;
     $tags['X_NOTIFY_EVENT'] = $event;
     $template_dir = $event_info['mail_template_dir'];
     $template = $event_info['mail_template'] . '.tpl';
     $subject = $event_info['mail_subject'];
     foreach ($notifications as $notification) {
         if (empty($omit_user_id) || $notification->getVar('not_uid') != $omit_user_id) {
             // user-specific tags
             //$tags['X_UNSUBSCRIBE_URL'] = 'TODO';
             // TODO: don't show unsubscribe link if it is 'one-time' ??
             $tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL . '/notifications.php';
             $tags = array_merge($tags, $extra_tags);
             $notification->notifyUser($template_dir, $template, $subject, $tags);
         }
     }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:101,代码来源:notification.php

示例11: xsns_main_trigger_event

function xsns_main_trigger_event( $category , $item_id , $event , $extra_tags=array() , $user_list=array() , $omit_user_id=null )
{
	global $xoopsModule , $xoopsConfig , $mydirname , $mydirpath;

	$notification_handler =& xoops_gethandler('notification') ;

	$mid = $xoopsModule->getVar('mid') ;

	// language
	$language = empty($xoopsConfig['language']) ? 'japanese' : $xoopsConfig['language'] ;
	$trustdirpath = dirname(dirname(__FILE__));
	if( file_exists( "$mydirpath/language/$language/mail_template/" ) ) {
		$mail_template_dir = "$mydirpath/language/$language/mail_template/" ;
	}
	else if( file_exists( $trustdirpath."/language/$language/mail_template/" ) ) {
		$mail_template_dir = $trustdirpath."/language/$language/mail_template/";
	}
	else {
		$mail_template_dir = $trustdirpath."/language/japanese/mail_template/";
	}
	
	// Check if event is enabled
	$config_handler =& xoops_gethandler('config');
	$mod_config =& $config_handler->getConfigsByCat(0,$mid);
	if (empty($mod_config['notification_enabled'])) {
		return false;
	}
	$category_info =& notificationCategoryInfo ($category, $mid);
	$event_info =& notificationEventInfo ($category, $event, $mid);
	if (!in_array(notificationGenerateConfig($category_info,$event_info,'option_name'),$mod_config['notification_events']) && empty($event_info['invisible'])) {
		return false;
	}

	if (!isset($omit_user_id)) {
		global $xoopsUser;
		if (!empty($xoopsUser)) {
			$omit_user_id = $xoopsUser->getVar('uid');
		} else {
			$omit_user_id = 0;
		}
	}
	$criteria = new CriteriaCompo();
	$criteria->add(new Criteria('not_modid', intval($mid)));
	$criteria->add(new Criteria('not_category', $category));
	$criteria->add(new Criteria('not_itemid', intval($item_id)));
	$criteria->add(new Criteria('not_event', $event));
	$mode_criteria = new CriteriaCompo();
	$mode_criteria->add (new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDALWAYS), 'OR');
	$mode_criteria->add (new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE), 'OR');
	$mode_criteria->add (new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT), 'OR');
	$criteria->add($mode_criteria);
	if (!empty($user_list)) {
		$user_criteria = new CriteriaCompo();
		foreach ($user_list as $user) {
			$user_criteria->add (new Criteria('not_uid', $user), 'OR');
		}
		$criteria->add($user_criteria);
	}
	$notifications =& $notification_handler->getObjects($criteria);
	if (empty($notifications)) {
		return;
	}

	// Add some tag substitutions here
	$tags = array();
	// {X_ITEM_NAME} {X_ITEM_URL} {X_ITEM_TYPE} from lookup_func are disabled
	$tags['X_MODULE'] = $xoopsModule->getVar('name','n');
	$tags['X_MODULE_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/';
	$tags['X_NOTIFY_CATEGORY'] = $category;
	$tags['X_NOTIFY_EVENT'] = $event;

	$template = $event_info['mail_template'] . '.tpl';
	$subject = $event_info['mail_subject'];

	foreach ($notifications as $notification) {
		if (empty($omit_user_id) || $notification->getVar('not_uid') != $omit_user_id) {
			$tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL . '/notifications.php';
			$tags = array_merge($tags, $extra_tags);
			
			$notification->notifyUser($mail_template_dir, $template, $subject, $tags);
		}
	}
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:83,代码来源:notification.php

示例12: xoops_module_install


//.........这里部分代码省略.........
                }
                $configs = $module->getInfo('config');
                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'])) {
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:67,代码来源:modulesadmin.php

示例13: 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) {
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:main.php

示例14: xoops_module_update


//.........这里部分代码省略.........
        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_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']) {
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:67,代码来源:modulesadmin.php

示例15: notificationCategoryInfo

         $lookup_func = '';
         if (!empty($not_config['lookup_file'])) {
             $lookup_file = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname') . '/' . $not_config['lookup_file']);
             if (file_exists($lookup_file)) {
                 include_once $lookup_file;
                 if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
                     $lookup_func = $not_config['lookup_func'];
                 }
             }
         }
     }
     $category = $n->getVar('not_category');
     if ($category != $prev_category) {
         $prev_category = $category;
         $prev_item = -1;
         $category_info =& notificationCategoryInfo($category, $modid);
         $modules[$modid]['categories'][$category] = array('name' => $category, 'title' => $category_info['title'], 'items' => array());
     }
     $item = $n->getVar('not_itemid');
     if ($item != $prev_item) {
         $prev_item = $item;
         if (!empty($lookup_func)) {
             $item_info = $lookup_func($category, $item);
         } else {
             $item_info = array('name' => '[' . _NOT_NAMENOTAVAILABLE . ']', 'url' => '');
         }
         $modules[$modid]['categories'][$category]['items'][$item] = array('id' => $item, 'name' => $item_info['name'], 'url' => $item_info['url'], 'notifications' => array());
     }
     $event_info =& notificationEventInfo($category, $n->getVar('not_event'), $n->getVar('not_modid'));
     $modules[$modid]['categories'][$category]['items'][$item]['notifications'][] = array('id' => $n->getVar('not_id'), 'module_id' => $n->getVar('not_modid'), 'category' => $n->getVar('not_category'), 'category_title' => $category_info['title'], 'item_id' => $n->getVar('not_itemid'), 'event' => $n->getVar('not_event'), 'event_title' => $event_info['title'], 'user_id' => $n->getVar('not_uid'));
 }
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:31,代码来源:notifications.php


注:本文中的notificationCategoryInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。