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


PHP CKunenaTools::KSelectList方法代码示例

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


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

示例1: editUserProfile

function editUserProfile($option, $uid)
{
    if (empty($uid[0])) {
        echo JText::_('COM_KUNENA_PROFILE_NO_USER');
        return;
    }
    $kunena_db =& JFactory::getDBO();
    $kunena_acl =& JFactory::getACL();
    $kunena_db->setQuery("SELECT * FROM #__kunena_users LEFT JOIN #__users on #__users.id=#__kunena_users.userid WHERE userid={$uid['0']}");
    $userDetails = $kunena_db->loadObjectList();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    $user = $userDetails[0];
    //Mambo userids are unique, so we don't worry about that
    $prefview = $user->view;
    $ordering = $user->ordering;
    $moderator = $user->moderator;
    $userRank = $user->rank;
    //grab all special ranks
    $kunena_db->setQuery("SELECT * FROM #__kunena_ranks WHERE rank_special = '1'");
    $specialRanks = $kunena_db->loadObjectList();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    //build select list options
    $yesnoRank[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_RANK_NO_ASSIGNED'));
    foreach ($specialRanks as $ranks) {
        $yesnoRank[] = JHTML::_('select.option', $ranks->rank_id, $ranks->rank_title);
    }
    //build special ranks select list
    $selectRank = JHTML::_('select.genericlist', $yesnoRank, 'newrank', 'class="inputbox" size="5"', 'value', 'text', $userRank);
    // make the select list for the view type
    $yesno[] = JHTML::_('select.option', 'flat', JText::_('COM_KUNENA_A_FLAT'));
    $yesno[] = JHTML::_('select.option', 'threaded', JText::_('COM_KUNENA_A_THREADED'));
    // build the html select list
    $selectPref = JHTML::_('select.genericlist', $yesno, 'newview', 'class="inputbox" size="2"', 'value', 'text', $prefview);
    // make the select list for the moderator flag
    $yesnoMod[] = JHTML::_('select.option', '1', JText::_('COM_KUNENA_ANN_YES'));
    $yesnoMod[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_ANN_NO'));
    // build the html select list
    $selectMod = JHTML::_('select.genericlist', $yesnoMod, 'moderator', 'class="inputbox" size="2"', 'value', 'text', $moderator);
    // make the select list for the moderator flag
    $yesnoOrder[] = JHTML::_('select.option', '0', JText::_('COM_KUNENA_USER_ORDER_ASC'));
    $yesnoOrder[] = JHTML::_('select.option', '1', JText::_('COM_KUNENA_USER_ORDER_DESC'));
    // build the html select list
    $selectOrder = JHTML::_('select.genericlist', $yesnoOrder, 'neworder', 'class="inputbox" size="2"', 'value', 'text', $ordering);
    //get all subscriptions for this user
    $kunena_db->setQuery("select thread from #__kunena_subscriptions where userid={$uid['0']}");
    $subslist = $kunena_db->loadObjectList();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    //get all categories subscriptions for this user
    $kunena_db->setQuery("select catid from #__kunena_subscriptions_categories where userid={$uid['0']}");
    $subscatslist = $kunena_db->loadObjectList();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    //get all moderation category ids for this user
    $kunena_db->setQuery("select catid from #__kunena_moderation where userid=" . $uid[0]);
    $modCatList = $kunena_db->loadResultArray();
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    if ($moderator && empty($modCatList)) {
        $modCatList[] = 0;
    }
    $categoryList = array();
    $categoryList[] = JHTML::_('select.option', 0, JText::_('COM_KUNENA_GLOBAL_MODERATOR'));
    $modCats = CKunenaTools::KSelectList('catid[]', $categoryList, 'class="inputbox" multiple="multiple"', false, 'kforums', $modCatList);
    //get all IPs used by this user
    $kunena_db->setQuery("SELECT ip FROM #__kunena_messages WHERE userid={$uid['0']} GROUP BY ip");
    $iplist = implode("','", $kunena_db->loadResultArray());
    if (KunenaError::checkDatabaseError()) {
        return;
    }
    $list = array();
    if ($iplist) {
        $iplist = "'{$iplist}'";
        $kunena_db->setQuery("SELECT m.ip,m.userid,u.username,COUNT(*) as mescnt FROM #__kunena_messages AS m INNER JOIN #__users AS u ON m.userid=u.id WHERE m.ip IN ({$iplist}) GROUP BY m.userid,m.ip");
        $list = $kunena_db->loadObjectlist();
        if (KunenaError::checkDatabaseError()) {
            return;
        }
    }
    $useridslist = array();
    foreach ($list as $item) {
        $useridslist[$item->ip][] = $item;
    }
    html_Kunena::editUserProfile($option, $user, $subslist, $subscatslist, $selectRank, $selectPref, $selectMod, $selectOrder, $uid[0], $modCats, $useridslist);
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:92,代码来源:admin.kunena.php

示例2: moderate

 protected function moderate($modchoices = '', $modthread = false)
 {
     if (!$this->load()) {
         return false;
     }
     if ($this->moderatorProtection()) {
         return false;
     }
     if ($this->isUserBanned()) {
         return false;
     }
     if ($this->isIPBanned()) {
         return false;
     }
     require_once KUNENA_PATH_LIB . '/kunena.moderation.class.php';
     $this->moderateTopic = $modthread;
     $this->moderateMultiplesChoices = $modchoices;
     // Get list of latest messages:
     $query = "SELECT id,subject FROM #__kunena_messages WHERE catid={$this->_db->Quote($this->catid)} AND parent=0 AND hold=0 AND moved=0 AND thread!={$this->_db->Quote($this->msg_cat->thread)} ORDER BY id DESC";
     $this->_db->setQuery($query, 0, 30);
     $messagesList = $this->_db->loadObjectlist();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     // Get thread and reply count from current message:
     $query = "SELECT t.id,t.subject,COUNT(mm.id) AS replies FROM #__kunena_messages AS m\n\t\t\tINNER JOIN #__kunena_messages AS t ON m.thread=t.id\n\t\t\tLEFT JOIN #__kunena_messages AS mm ON mm.thread=m.thread AND mm.id > m.id\n\t\t\tWHERE m.id={$this->_db->Quote($this->id)}\n\t\t\tGROUP BY m.thread";
     $this->_db->setQuery($query, 0, 1);
     $this->threadmsg = $this->_db->loadObject();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     $messages = array();
     if ($this->moderateTopic) {
         $messages[] = JHTML::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_MOVE_TOPIC'));
     } else {
         $messages[] = JHTML::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_CREATE_TOPIC'));
     }
     $messages[] = JHTML::_('select.option', -1, JText::_('COM_KUNENA_MODERATION_ENTER_TOPIC'));
     foreach ($messagesList as $mes) {
         $messages[] = JHTML::_('select.option', $mes->id, kunena_htmlspecialchars($mes->subject));
     }
     $this->messagelist = JHTML::_('select.genericlist', $messages, 'targettopic', 'class="inputbox"', 'value', 'text', 0, 'kmod_targettopic');
     $options = array();
     $this->categorylist = CKunenaTools::KSelectList('targetcat', $options, 'class="inputbox kmove_selectbox"', false, 'kmod_categories', $this->catid);
     $this->message = $this->msg_cat;
     $this->user = KunenaFactory::getUser($this->msg_cat->userid);
     CKunenaTools::loadTemplate('/moderate/moderate.php');
 }
开发者ID:redigy,项目名称:Kunena-1.6,代码行数:48,代码来源:post.php


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