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


PHP dbSelectLimitAssoc函数代码示例

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


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

示例1: fixNumbering

/**
* fixes the numbering of questions
* @param <type> $fixnumbering
*/
function fixNumbering($fixnumbering, $iSurveyID)
{
    Yii::app()->loadHelper("database");
    LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyID);
    //Fix a question id - requires renumbering a question
    $oldqid = $fixnumbering;
    $query = "SELECT qid FROM {{questions}} ORDER BY qid DESC";
    $result = dbSelectLimitAssoc($query, 1);
    foreach ($result->readAll() as $row) {
        $lastqid = $row['qid'];
    }
    $newqid = $lastqid + 1;
    $query = "UPDATE {{questions}} SET qid={$newqid} WHERE qid={$oldqid}";
    $result = db_execute_assosc($query);
    // Update subquestions
    $query = "UPDATE {{questions}} SET parent_qid={$newqid} WHERE parent_qid={$oldqid}";
    $result = db_execute_assosc($query);
    //Update conditions.. firstly conditions FOR this question
    $query = "UPDATE {{conditions}} SET qid={$newqid} WHERE qid={$oldqid}";
    $result = db_execute_assosc($query);
    //Now conditions based upon this question
    $query = "SELECT cqid, cfieldname FROM {{conditions}} WHERE cqid={$oldqid}";
    $result = dbExecuteAssoc($query);
    foreach ($result->readAll() as $row) {
        $switcher[] = array("cqid" => $row['cqid'], "cfieldname" => $row['cfieldname']);
    }
    if (isset($switcher)) {
        foreach ($switcher as $switch) {
            $query = "UPDATE {{conditions}}\n            SET cqid={$newqid},\n            cfieldname='" . str_replace("X" . $oldqid, "X" . $newqid, $switch['cfieldname']) . "'\n            WHERE cqid={$oldqid}";
            $result = db_execute_assosc($query);
        }
    }
    // TMSW Conditions->Relevance:  (1) Call LEM->ConvertConditionsToRelevance()when done. (2) Should relevance for old conditions be removed first?
    //Now question_attributes
    $query = "UPDATE {{question_attributes}} SET qid={$newqid} WHERE qid={$oldqid}";
    $result = db_execute_assosc($query);
    //Now answers
    $query = "UPDATE {{answers}} SET qid={$newqid} WHERE qid={$oldqid}";
    $result = db_execute_assosc($query);
    LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyID);
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:45,代码来源:activate_helper.php

示例2: setuserpermissions

/**
* set the rights of a user and his children
*
* @param int $uid the user id
* @param mixed $rights rights array
*/
function setuserpermissions($uid, $rights)
{
    $uid = sanitize_int($uid);
    $updates = "create_survey=" . $rights['create_survey'] . ", create_user=" . $rights['create_user'] . ", participant_panel=" . $rights['participant_panel'] . ", delete_user=" . $rights['delete_user'] . ", superadmin=" . $rights['superadmin'] . ", configurator=" . $rights['configurator'] . ", manage_template=" . $rights['manage_template'] . ", manage_label=" . $rights['manage_label'];
    $uquery = "UPDATE {{users}} SET " . $updates . " WHERE uid = " . $uid;
    return dbSelectLimitAssoc($uquery);
    //Checked
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:14,代码来源:common_helper.php

示例3: index

 /**
  * Load viewing of a user group screen.
  * @param bool $ugid
  * @param array|bool $header (type=success, warning)(message=localized message)
  * @return void
  */
 public function index($ugid = false, $header = false)
 {
     if (!Permission::model()->hasGlobalPermission('usergroups', 'read')) {
         Yii::app()->session['flashmessage'] = gT('Access denied!');
         $this->getController()->redirect(App()->createUrl("/admin"));
     }
     if ($ugid != false) {
         $ugid = (int) $ugid;
     }
     if (!empty($header)) {
         $aData['headercfg'] = $header;
     } else {
         $aData = array();
     }
     $aViewUrls = array();
     $aData['ugid'] = $ugid;
     $aData['imageurl'] = Yii::app()->getConfig("adminimageurl");
     if (Yii::app()->session['loginID']) {
         if ($ugid) {
             $ugid = sanitize_int($ugid);
             $aData["usergroupid"] = $ugid;
             $result = UserGroup::model()->requestViewGroup($ugid, Yii::app()->session["loginID"]);
             $crow = $result[0];
             if ($result) {
                 $aData["groupfound"] = true;
                 $aData["groupname"] = $crow['name'];
                 if (!empty($crow['description'])) {
                     $aData["usergroupdescription"] = $crow['description'];
                 } else {
                     $aData["usergroupdescription"] = "";
                 }
             }
             //$this->user_in_groups_model = new User_in_groups;
             $eguquery = "SELECT * FROM {{user_in_groups}} AS a INNER JOIN {{users}} AS b ON a.uid = b.uid WHERE ugid = " . $ugid . " ORDER BY b.users_name";
             $eguresult = dbExecuteAssoc($eguquery);
             $aUserInGroupsResult = $eguresult->readAll();
             $query2 = "SELECT ugid FROM {{user_groups}} WHERE ugid = " . $ugid;
             if (!Permission::model()->hasGlobalPermission('superadmin', 'read')) {
                 $query2 .= " AND owner_id = " . Yii::app()->session['loginID'];
             }
             $result2 = dbSelectLimitAssoc($query2, 1);
             $row2 = $result2->readAll();
             $row = 1;
             $userloop = array();
             $bgcc = "oddrow";
             foreach ($aUserInGroupsResult as $egurow) {
                 if ($bgcc == "evenrow") {
                     $bgcc = "oddrow";
                 } else {
                     $bgcc = "evenrow";
                 }
                 $userloop[$row]["userid"] = $egurow['uid'];
                 //	output users
                 $userloop[$row]["rowclass"] = $bgcc;
                 if (Permission::model()->hasGlobalPermission('superadmin', 'update')) {
                     $userloop[$row]["displayactions"] = true;
                 } else {
                     $userloop[$row]["displayactions"] = false;
                 }
                 $userloop[$row]["username"] = $egurow['users_name'];
                 $userloop[$row]["email"] = $egurow['email'];
                 $row++;
             }
             $aData["userloop"] = $userloop;
             if (isset($row2[0]['ugid'])) {
                 $aData["useradddialog"] = true;
                 $aData["useraddusers"] = getGroupUserList($ugid, 'optionlist');
                 $aData["useraddurl"] = "";
             }
             $aViewUrls[] = 'viewUserGroup_view';
         } else {
             //show listing
             $aViewUrls['usergroups_view'][] = array();
             $aData['model'] = UserGroup::model();
         }
     }
     if ($ugid == false) {
         $aData['usergroupbar']['returnbutton']['url'] = 'admin/index';
         $aData['usergroupbar']['returnbutton']['text'] = gT('Return to admin home');
     } else {
         $aData['usergroupbar']['edit'] = TRUE;
         $aData['usergroupbar']['closebutton']['url'] = Yii::app()->createUrl('admin/usergroups/sa/view');
         // Close button
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
     }
     if (!empty($header)) {
         return array($aViewUrls, $aData);
     } else {
         $this->_renderWrappedTemplate('usergroup', $aViewUrls, $aData);
     }
 }
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:99,代码来源:usergroups.php

示例4: index

 /**
  * Load viewing of a user group screen.
  * @param bool $ugid
  * @param array|bool $header (type=success, warning)(message=localized message)
  * @return void
  */
 public function index($ugid = false, $header = false)
 {
     if ($ugid != false) {
         $ugid = (int) $ugid;
     }
     if (!empty($header)) {
         $aData['headercfg'] = $header;
     } else {
         $aData = array();
     }
     $aViewUrls = array();
     $aData['ugid'] = $ugid;
     $aData['imageurl'] = Yii::app()->getConfig("adminimageurl");
     $clang = Yii::app()->lang;
     if (Yii::app()->session['loginID']) {
         if ($ugid) {
             $ugid = sanitize_int($ugid);
             $aData["usergroupid"] = $ugid;
             $result = UserGroup::model()->requestViewGroup($ugid, Yii::app()->session["loginID"]);
             $crow = $result[0];
             if ($result) {
                 $aData["groupfound"] = true;
                 $aData["groupname"] = $crow['name'];
                 if (!empty($crow['description'])) {
                     $aData["usergroupdescription"] = $crow['description'];
                 } else {
                     $aData["usergroupdescription"] = "";
                 }
             }
             //$this->user_in_groups_model = new User_in_groups;
             $eguquery = "SELECT * FROM {{user_in_groups}} AS a INNER JOIN {{users}} AS b ON a.uid = b.uid WHERE ugid = " . $ugid . " ORDER BY b.users_name";
             $eguresult = dbExecuteAssoc($eguquery);
             $aUserInGroupsResult = $eguresult->readAll();
             $query2 = "SELECT ugid FROM {{user_groups}} WHERE ugid = " . $ugid . " AND owner_id = " . Yii::app()->session['loginID'];
             $result2 = dbSelectLimitAssoc($query2, 1);
             $row2 = $result2->readAll();
             $row = 1;
             $userloop = array();
             $bgcc = "oddrow";
             foreach ($aUserInGroupsResult as $egurow) {
                 if ($bgcc == "evenrow") {
                     $bgcc = "oddrow";
                 } else {
                     $bgcc = "evenrow";
                 }
                 $userloop[$row]["userid"] = $egurow['uid'];
                 //	output users
                 $userloop[$row]["rowclass"] = $bgcc;
                 if (Permission::model()->hasGlobalPermission('superadmin', 'update')) {
                     $userloop[$row]["displayactions"] = true;
                 } else {
                     $userloop[$row]["displayactions"] = false;
                 }
                 $userloop[$row]["username"] = $egurow['users_name'];
                 $userloop[$row]["email"] = $egurow['email'];
                 $row++;
             }
             $aData["userloop"] = $userloop;
             if (isset($row2[0]['ugid'])) {
                 $aData["useradddialog"] = true;
                 $aData["useraddusers"] = getGroupUserList($ugid, 'optionlist');
                 $aData["useraddurl"] = "";
             }
         }
         $aViewUrls[] = 'viewUserGroup_view';
     }
     if (!empty($header)) {
         return array($aViewUrls, $aData);
     } else {
         $this->_renderWrappedTemplate('usergroup', $aViewUrls, $aData);
     }
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:78,代码来源:usergroups.php

示例5: htmlspecialchars

<?php $clang->eT("Set User Rights");?>:<?php echo htmlspecialchars(sanitize_user($_POST['user']));?>
</td>
</tr>

<?php // HERE WE LIST FOR USER RIGHTS YOU CAN SET TO a USER
// YOU CAN ONLY SET AT MOST THE RIGHTS YOU have yourself
$userlist = getUserList();
foreach ($userlist as $usr) {
    if ($usr['uid'] == $postuserid) {
        $squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, participant_panel,manage_template, manage_label FROM {{users}} WHERE uid=".Yii::app()->session['loginID'];	//		added by Dennis
        $sresult = dbSelectLimitAssoc($squery); //Checked
        $parent = $sresult->read();

        // Initial SuperAdmin has parent_id == 0
        $adminquery = "SELECT uid FROM {{users}} WHERE parent_id=0";
        $adminresult = dbSelectLimitAssoc($adminquery, 1);
        $row=$adminresult->read();
		?>

        <tr>

        <?php // Only Initial SuperAdmin can give SuperAdmin rights
        if($row['uid'] == Yii::app()->session['loginID'])
        { // RENAMED AS SUPERADMIN
            echo "<th align='center' class='admincell'>".$clang->gT("Super-Administrator")."</th>\n";
            echo "<th align='center' >".$clang->gT("Participant panel")."</th>\n";
        }
        if($parent['create_survey']) {
            echo "<th align='center'>".$clang->gT("Create survey")."</th>\n";
        }
        if($parent['configurator']) {
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:31,代码来源:setuserrights.php


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