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


PHP create_user_key函数代码示例

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


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

示例1: key_form

    }
}
/// First create the form
$editform = new key_form();
$editform->set_data($key);
if ($editform->is_cancelled()) {
    redirect($returnurl);
} elseif ($data = $editform->get_data()) {
    if ($data->id) {
        $record = new object();
        $record->id = $data->id;
        $record->iprestriction = $data->iprestriction;
        $record->validuntil = $data->validuntil;
        update_record('user_private_key', $record);
    } else {
        create_user_key('grade/export', $USER->id, $course->id, $data->iprestriction, $data->validuntil);
    }
    redirect($returnurl);
}
$strkeys = get_string('userkeys', 'userkey');
$strgrades = get_string('grades');
if ($id) {
    $strheading = get_string('edituserkey', 'userkey');
} else {
    $strheading = get_string('createuserkey', 'userkey');
}
$navlinks = array(array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strkeys, 'link' => $CFG->wwwroot . '/grade/export/keymanager.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strheading, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
/// Print header
print_header_simple($strkeys, ': ' . $strkeys, $navigation, '', '', true, '', navmenu($course));
$editform->display();
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:key.php

示例2: process_form

 /**
  * Init object based using data from form
  * @param object $formdata
  */
 function process_form($formdata)
 {
     global $USER;
     $this->columns = array();
     if (!empty($formdata->itemids)) {
         foreach ($formdata->itemids as $itemid => $selected) {
             if ($selected and array_key_exists($itemid, $this->grade_items)) {
                 $this->columns[$itemid] =& $this->grade_items[$itemid];
             }
         }
     } else {
         foreach ($this->grade_items as $itemid => $unused) {
             $this->columns[$itemid] =& $this->grade_items[$itemid];
         }
     }
     if (isset($formdata->key)) {
         if ($formdata->key == 1 && isset($formdata->iprestriction) && isset($formdata->validuntil)) {
             // Create a new key
             $formdata->key = create_user_key('grade/export', $USER->id, $this->course->id, $formdata->iprestriction, $formdata->validuntil);
         }
         $this->userkey = $formdata->key;
     }
     if (isset($formdata->export_letters)) {
         $this->export_letters = $formdata->export_letters;
     }
     if (isset($formdata->export_feedback)) {
         $this->export_feedback = $formdata->export_feedback;
     }
     if (isset($formdata->previewrows)) {
         $this->previewrows = $formdata->previewrows;
     }
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:36,代码来源:lib.php

示例3: process_form

 /**
  * Init object based using data from form
  * @param object $formdata
  */
 function process_form($formdata)
 {
     global $USER;
     $this->columns = array();
     if (!empty($formdata->itemids)) {
         if ($formdata->itemids == '-1') {
             //user deselected all items
         } else {
             foreach ($formdata->itemids as $itemid => $selected) {
                 if ($selected and array_key_exists($itemid, $this->grade_items)) {
                     $this->columns[$itemid] =& $this->grade_items[$itemid];
                 }
             }
         }
     } else {
         foreach ($this->grade_items as $itemid => $unused) {
             $this->columns[$itemid] =& $this->grade_items[$itemid];
         }
     }
     if (isset($formdata->key)) {
         if ($formdata->key == 1 && isset($formdata->iprestriction) && isset($formdata->validuntil)) {
             // Create a new key
             $formdata->key = create_user_key('grade/export', $USER->id, $this->course->id, $formdata->iprestriction, $formdata->validuntil);
         }
         $this->userkey = $formdata->key;
     }
     if (isset($formdata->decimals)) {
         $this->decimalpoints = $formdata->decimals;
     }
     if (isset($formdata->export_letters)) {
         $this->export_letters = $formdata->export_letters;
     }
     if (isset($formdata->export_feedback)) {
         $this->export_feedback = $formdata->export_feedback;
     }
     if (isset($formdata->export_onlyactive)) {
         $this->onlyactive = $formdata->export_onlyactive;
     }
     if (isset($formdata->previewrows)) {
         $this->previewrows = $formdata->previewrows;
     }
     if (isset($formdata->display)) {
         $this->displaytype = $formdata->display;
         // Used by grade exports which accept multiple display types.
         // If the checkbox value is 0 (unchecked) then remove it.
         if (is_array($formdata->display)) {
             $this->displaytype = array_filter($formdata->display);
         }
     }
     if (isset($formdata->updatedgradesonly)) {
         $this->updatedgradesonly = $formdata->updatedgradesonly;
     }
 }
开发者ID:elie89,项目名称:moodle,代码行数:57,代码来源:lib.php

示例4: get_user_key

/**
 * Gets a private user access key (and creates one if one doesn't exist).
 *
 * @param string $script unique target identifier
 * @param int $userid
 * @param int $instance optional instance id
 * @param string $iprestriction optional ip restricted access
 * @param int $validuntil key valid only until given date
 * @return string access key value
 */
function get_user_key($script, $userid, $instance = null, $iprestriction = null, $validuntil = null)
{
    global $DB;
    if ($key = $DB->get_record('user_private_key', array('script' => $script, 'userid' => $userid, 'instance' => $instance, 'iprestriction' => $iprestriction, 'validuntil' => $validuntil))) {
        return $key->value;
    } else {
        return create_user_key($script, $userid, $instance, $iprestriction, $validuntil);
    }
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:19,代码来源:moodlelib.php

示例5: get_autologin_key

 /**
  * Creates an auto-login key for the current user, this key is restricted by time and ip address.
  *
  * @return string the key
  * @since Moodle 3.2
  */
 public static function get_autologin_key()
 {
     global $USER;
     // Delete previous keys.
     delete_user_key('tool_mobile', $USER->id);
     // Create a new key.
     $iprestriction = getremoteaddr();
     $validuntil = time() + self::LOGIN_KEY_TTL;
     return create_user_key('tool_mobile', $USER->id, null, $iprestriction, $validuntil);
 }
开发者ID:dg711,项目名称:moodle,代码行数:16,代码来源:api.php


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