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


PHP classXML::addElementasRecord方法代码示例

本文整理汇总了PHP中classXML::addElementasRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP classXML::addElementasRecord方法的具体用法?PHP classXML::addElementasRecord怎么用?PHP classXML::addElementasRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在classXML的用法示例。


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

示例1: _handleNotificationTypes

 /**
  * Returns a list of notification options
  *
  * @return	string		XML
  */
 protected function _handleNotificationTypes()
 {
     /* Check to see if notifications are enabled */
     if (!IPSMember::canReceiveMobileNotifications()) {
         $this->_returnError("You are not authorized to receive mobile notifications");
     }
     /* Lang */
     $this->lang->loadLanguageFile(array('public_usercp'), 'core');
     /* Notifications Library */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
     $notifyLibrary = new $classToLoad($this->registry);
     $notifyLibrary->setMember($this->memberData);
     /* Options */
     $_basicOptions = array(array('email', $this->lang->words['notopt__email']), array('pm', $this->lang->words['notopt__pm']), array('inline', $this->lang->words['notopt__inline']), array('mobile', $this->lang->words['notopt__mobile']));
     $_configOptions = $notifyLibrary->getNotificationData(TRUE);
     $_notifyConfig = $notifyLibrary->getMemberNotificationConfig($this->memberData);
     $_defaultConfig = $notifyLibrary->getDefaultNotificationConfig();
     $_formOptions = array();
     foreach ($_configOptions as $option) {
         $_thisConfig = $_notifyConfig[$option['key']];
         //-----------------------------------------
         // Determine available options
         //-----------------------------------------
         $_available = array();
         foreach ($_basicOptions as $_bo) {
             if (!is_array($_defaultConfig[$option['key']]['disabled']) or !in_array($_bo[0], $_defaultConfig[$option['key']]['disabled'])) {
                 $_available[] = $_bo;
             }
         }
         //-----------------------------------------
         // If none available, at least give inline
         //-----------------------------------------
         if (!count($_available)) {
             $_available[] = array('inline', $this->lang->words['notify__inline']);
         }
         //-----------------------------------------
         // Start setting data to pass to form
         //-----------------------------------------
         $_formOptions[$option['key']] = array();
         $_formOptions[$option['key']]['key'] = $option['key'];
         //-----------------------------------------
         // Rikki asked for this...
         //-----------------------------------------
         foreach ($_available as $_availOption) {
             $_formOptions[$option['key']]['options'][$_availOption[0]] = $_availOption;
         }
         //$_formOptions[ $option['key'] ]['options']		= $_available;
         $_formOptions[$option['key']]['defaults'] = is_array($_thisConfig['selected']) ? $_thisConfig['selected'] : array();
         $_formOptions[$option['key']]['disabled'] = 0;
         //-----------------------------------------
         // Don't allow member to configure
         // Still show, but disable on form
         //-----------------------------------------
         if ($_defaultConfig[$option['key']]['disable_override']) {
             $_formOptions[$option['key']]['disabled'] = 1;
             $_formOptions[$option['key']]['defaults'] = is_array($_defaultConfig[$option['key']]['selected']) ? $_defaultConfig[$option['key']]['selected'] : array();
         }
     }
     /* Groups */
     $this->notifyGroups = array('topics_posts' => array('new_topic', 'new_reply', 'post_quoted'), 'status_updates' => array('reply_your_status', 'reply_any_status', 'friend_status_update'), 'profiles_friends' => array('profile_comment', 'profile_comment_pending', 'friend_request', 'friend_request_pending', 'friend_request_approve'), 'private_msgs' => array('new_private_message', 'reply_private_message', 'invite_private_message'));
     /* XML Parser */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML('utf-8');
     $xml->newXMLDocument();
     /* Build Document */
     $xml->addElement('notifications');
     foreach ($this->notifyGroups as $groupKey => $group) {
         $xml->addElement('group', 'notifications');
         $xml->addElementasRecord('group', array('info'), array('groupTitle' => IPSText::UNhtmlspecialchars($this->lang->words['notifytitle_' . $groupKey])));
         $xml->addElement('options', 'group');
         foreach ($group as $key) {
             if (!is_array($_formOptions[$key])) {
                 continue;
             }
             /* Set the done flag */
             $_formOptions[$key]['done'] = 1;
             /* Set the title */
             $_title = $this->lang->words['notify__short__' . $key] ? $this->lang->words['notify__short__' . $key] : $this->lang->words['notify__' . $key];
             /* Add to XML */
             $xml->addElementAsRecord('options', array('option'), array('optionKey' => $key, 'optionTitle' => IPSText::UNhtmlspecialchars($_title), 'optionEnabled' => in_array('mobile', $_formOptions[$key]['defaults']) ? '1' : '0'));
         }
     }
     /* Other Options */
     $xml->addElement('group', 'notifications');
     $xml->addElementasRecord('group', array('info'), array('groupTitle' => IPSText::UNhtmlspecialchars($this->lang->words['notifytitle_other'])));
     $xml->addElement('options', 'group');
     foreach ($_formOptions as $key => $data) {
         if ($data['done']) {
             continue;
         }
         /* Set the title */
         $_title = $this->lang->words['notify__short__' . $key] ? $this->lang->words['notify__short__' . $key] : $this->lang->words['notify__' . $key];
         /* Add to XML */
         $xml->addElementAsRecord('options', array('option'), array('optionKey' => $key, 'optionTitle' => IPSText::UNhtmlspecialchars($_title), 'optionEnabled' => in_array('mobile', $data['defaults']) ? '1' : '0'));
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:101,代码来源:index.php


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