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


PHP Queue::set方法代码示例

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


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

示例1: create

 public function create()
 {
     $this->assertLoggedIn();
     $this->setTitle('Create a New Queue');
     if ($this->args('submit')) {
         //did we get a name?
         if (!$this->args('name')) {
             $errors['name'] = "You need to provide a name.";
             $errorfields['name'] = 'error';
         }
         //okay, we good?
         if (empty($errors)) {
             //woot!
             $q = new Queue();
             $q->set('name', $this->args('name'));
             $q->set('user_id', User::$me->id);
             $q->save();
             //todo: send a confirmation email.
             Activity::log("created a new queue named " . $q->getLink() . ".");
             $this->forwardToUrl($q->getUrl());
         } else {
             $this->set('errors', $errors);
             $this->set('errorfields', $errorfields);
             $this->setArg('name');
         }
     }
 }
开发者ID:ricberw,项目名称:BotQueue,代码行数:27,代码来源:queue.php

示例2: register

 public function register()
 {
     $registerForm = $this->_createRegisterForm();
     $this->set('register_form', $registerForm);
     if ($registerForm->checkSubmitAndValidate($this->args())) {
         $username = $this->args('username');
         if (!Verify::username($username, $reason)) {
             /** @var FormField $field */
             $field = $registerForm->get('username');
             $field->error($reason);
         }
         $email = $this->args('email');
         $testUser = User::byEmail($email);
         if ($testUser->isHydrated()) {
             /** @var FormField $emailField */
             $emailField = $registerForm->get('email');
             $emailField->error("That email is already being used");
         }
         if ($this->args('pass1') != $this->args('pass2')) {
             /** @var FormField $field */
             $field = $registerForm->get('pass2');
             $field->error("Your passwords do not match");
         }
         if (!$registerForm->hasError()) {
             //woot!
             $user = new User();
             $user->set('username', $username);
             $user->set('email', $email);
             $user->set('pass_hash', User::hashPass($this->args('pass1')));
             $user->set('registered_on', date("Y-m-d H:i:s"));
             $user->save();
             //create a default queue for them
             $q = new Queue();
             $q->set("name", 'Default');
             $q->set("user_id", $user->id);
             $q->save();
             Activity::log("registered a new account on BotQueue.", $user);
             $text = Controller::byName('email')->renderView('new_user', array('user' => $user));
             $html = Controller::byName('email')->renderView('new_user_html', array('user' => $user));
             Email::queue($user, "Welcome to " . RR_PROJECT_NAME . "!", $text, $html);
             //automatically log them in.
             $token = $user->createToken();
             $token->setCookie();
             $this->forwardToURL("/");
         }
     }
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:47,代码来源:user.php

示例3: register

 public function register()
 {
     if ($this->args('submit') && $this->args('action') == 'register') {
         //validate username
         $username = $this->args('username');
         if (!Verify::username($username, $reason)) {
             $errors['username'] = $reason;
             $errorfields['username'] = 'error';
         }
         //validate email
         $email = $this->args('email');
         if (!Verify::email($email)) {
             $errors['email'] = "You must supply a valid email.";
             $errorfields['email'] = 'error';
         } else {
             $testUser = User::byEmail($email);
             if ($testUser->isHydrated()) {
                 $errors['email'] = "That email is already being used.";
                 $errorfields['email'] = 'error';
             }
         }
         //check passwords
         if ($this->args('pass1') != $this->args('pass2')) {
             $errors['password'] = "Your passwords do not match.";
             $errorfields['password'] = 'error';
         } else {
             if (!strlen($this->args('pass1'))) {
                 $errors['password'] = "You must enter a password.";
                 $errorfields['password'] = 'error';
             }
         }
         //okay, we good?
         if (empty($errors)) {
             //woot!
             $user = new User();
             $user->set('username', $username);
             $user->set('email', $email);
             $user->set('pass_hash', User::hashPass($this->args('pass1')));
             $user->set('registered_on', date("Y-m-d H:i:s"));
             $user->save();
             //create them a default queue.
             $q = new Queue();
             $q->set("name", 'Default');
             $q->set("user_id", $user->id);
             $q->save();
             //todo: send a confirmation email.
             Activity::log("registered a new account on BotQueue.", $user);
             //automatically log them in.
             $token = $user->createToken();
             $token->setCookie();
             $this->forwardToUrl('/');
         } else {
             $this->set('errors', $errors);
             $this->set('errorfields', $errorfields);
             $this->setArg('username');
             $this->setArg('email');
             $this->setArg('pass1');
             $this->setArg('pass2');
         }
     }
 }
开发者ID:ricberw,项目名称:BotQueue,代码行数:61,代码来源:user.php

示例4: api_createqueue

 public function api_createqueue()
 {
     if (!$this->args('name')) {
         throw new Exception('Queue name is a required parameter.');
     }
     $q = new Queue();
     $q->set('name', $this->args('name'));
     $q->set('user_id', User::$me->id);
     $q->save();
     Activity::log("created a queue named " . $q->getLink() . " via the API.");
     return $q->getAPIData();
 }
开发者ID:ricberw,项目名称:BotQueue,代码行数:12,代码来源:apiv1.php

示例5: Queue

}
if (isset($_POST['testbed'])) {
    $_POST['testbed'] = preg_replace("/\\s*\\(\\w+\\)\\s*\$/", "", $_POST['testbed']);
}
$objEditItem = new Queue();
if ($_REQUEST['id']) {
    $objEditItem->setUid($_REQUEST['id']);
    $objEditItem->load();
    if ($_REQUEST['mode'] && $_REQUEST['mode'] != 'save' && $_REQUEST['mode'] != 'save_reg') {
        switch ($_REQUEST['mode']) {
            case 'delete':
                $objEditItem->delete();
                $pMessage = $arrLanguageMessage['done_deleted'];
                break;
            default:
                $objEditItem->set('status', $_REQUEST['mode']);
                $objEditItem->update('status');
                $pMessage = $arrLanguageMessage['done_status'];
        }
        $objEditItem = new Queue();
    }
}
######################################################################
// --- NEW / UPDATE Regression-MiniReg Queue ----------------------------------------
if ($_REQUEST['mode'] == 'save_reg') {
    $suiteStrArr = array();
    $tbArr = array();
    if (is_array($_POST[module])) {
        foreach ($_POST[module] as $componentID) {
            array_push($suiteStrArr, $componentID);
        }
开发者ID:window98lsq,项目名称:autoweb,代码行数:31,代码来源:index.php


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