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


PHP Tag::setDefault方法代码示例

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


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

示例1: indexAction

 /**
  * The index action
  */
 public function indexAction()
 {
     if (!$this->request->isPost()) {
         Tag::setDefault('username', 'user@email.com');
         Tag::setDefault('password', 'hhf');
     }
 }
开发者ID:vnlita,项目名称:phalcon-angular-harryhogfootball,代码行数:10,代码来源:SessionController.php

示例2: verifyAction

 public function verifyAction($code)
 {
     if ($code) {
         $results = VerifyEmail::FindFirst("verifyCode = '" . $code . "'");
         if (!isset($results->cid)) {
             return $this->response->redirect("index/index");
         }
         $form = new RegisterForm();
         if (isset($results) && $results != '') {
             if ($results->active == 'Y') {
                 if (md5($results->time . '+' . $results->email) == $code) {
                     $this->view->form = $form;
                     Tag::setDefault('password', null);
                     Tag::setDefault('cid', $results->cid);
                     Tag::setDefault('email', $results->email);
                     $this->view->setVar("email", $results->email);
                 } else {
                     $this->flash->error('邮箱验证错误!');
                     $this->response->redirect("account/index");
                 }
             } else {
                 $this->flash->error('邮箱已经验证通过,请登录!');
                 $this->response->redirect("account/index");
             }
         } else {
             $this->flash->error('验证码已过期!');
             $this->response->redirect("index/index");
         }
     } else {
         $this->response->redirect("index/index");
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:32,代码来源:AccountController.php

示例3: profileAction

 public function profileAction()
 {
     $auth = $this->session->get('auth');
     $user = Users::findFirst($auth['id']);
     if ($user == false) {
         $this->_forward('index/index');
     }
     $request = $this->request;
     if (!$request->isPost()) {
         Tag::setDefault('name', $user->name);
         Tag::setDefault('email', $user->email);
     } else {
         $name = $request->getPost('name', 'string');
         $email = $request->getPost('email', 'email');
         $name = strip_tags($name);
         $user->name = $name;
         $user->email = $email;
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         } else {
             $this->flash->success('更新成功');
         }
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:26,代码来源:InvoicesController.php

示例4: indexAction

 public function indexAction()
 {
     if (!$this->request->isPost()) {
         Tag::setDefault('email', 'demo@phalconphp.com');
         Tag::setDefault('password', 'phalcon');
     }
 }
开发者ID:sbarrios,项目名称:exclie_phal,代码行数:7,代码来源:IndexController.php

示例5: indexAction

 public function indexAction()
 {
     if (!$this->request->isPost()) {
         Tag::setDefault('email', ' ');
         Tag::setDefault('password', '');
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:7,代码来源:SessionController.php

示例6: registerAction

 public function registerAction()
 {
     $request = $this->request;
     if ($request->isPost()) {
         $name = $request->getPost('name', array('string', 'striptags'));
         $username = $request->getPost('username', 'alphanum');
         $email = $request->getPost('email', 'email');
         $password = $request->getPost('password');
         $repeatPassword = $this->request->getPost('repeatPassword');
         if ($password != $repeatPassword) {
             $this->flash->error('Passwords are diferent');
             return false;
         }
         $user = new Users();
         $user->username = $username;
         $user->password = sha1($password);
         $user->name = $name;
         $user->email = $email;
         $user->created_at = new Phalcon\Db\RawValue('now()');
         $user->active = 'Y';
         if ($user->save() == false) {
             foreach ($user->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         } else {
             Tag::setDefault('email', '');
             Tag::setDefault('password', '');
             $this->flash->success('Thanks for sign-up, please log-in to start generating invoices');
             return $this->forward('session/index');
         }
     }
 }
开发者ID:fredd-for,项目名称:contrataciones,代码行数:32,代码来源:SessionController.php

示例7: testDisplayValues

 /**
  * @see 2402 issue
  * @link https://github.com/phalcon/cphalcon/issues/2402
  * @throws Exception
  */
 public function testDisplayValues()
 {
     Tag::setDefault('property1', 'testVal1');
     Tag::setDefault('property2', 'testVal2');
     Tag::setDefault('property3', 'testVal3');
     $this->assertTrue(Tag::hasValue('property1'));
     $this->assertTrue(Tag::hasValue('property2'));
     $this->assertTrue(Tag::hasValue('property3'));
     $this->assertEquals('testVal1', Tag::getValue('property1'));
     $this->assertEquals('testVal2', Tag::getValue('property2'));
     $this->assertEquals('testVal3', Tag::getValue('property3'));
 }
开发者ID:acwtools,项目名称:cphalcon,代码行数:17,代码来源:TagTest.php

示例8: editAction

 public function editAction($fileName)
 {
     $fileName = str_replace('..', '', $fileName);
     $controllersDir = Tools::getConfig()->application->controllersDir;
     if (!file_exists($controllersDir . '/' . $fileName)) {
         $this->flash->error('Controller could not be found', 'alert alert-error');
         return $this->dispatcher->forward(array('controller' => 'controllers', 'action' => 'list'));
     }
     Tag::setDefault('code', file_get_contents($controllersDir . '/' . $fileName));
     Tag::setDefault('name', $fileName);
     $this->view->setVar('name', $fileName);
 }
开发者ID:niden,项目名称:phalcon-devtools,代码行数:12,代码来源:ControllersController.php

示例9: testIssue947

 public function testIssue947()
 {
     $di = new Phalcon\DI\FactoryDefault();
     \Phalcon\Tag::setDI($di);
     $html = \Phalcon\Tag::radioField(array('test', 'value' => 1, 'checked' => 'checked'));
     $pos = strpos($html, 'checked="checked"');
     $this->assertTrue($pos !== FALSE);
     $html = \Phalcon\Tag::radioField(array('test', 'value' => 0));
     $pos = strpos($html, 'checked="checked"');
     $this->assertTrue($pos === FALSE);
     \Phalcon\Tag::setDefault("test", "0");
     $html = \Phalcon\Tag::radioField(array('test', 'value' => 0));
     $pos = strpos($html, 'checked="checked"');
     $this->assertTrue($pos !== FALSE);
 }
开发者ID:aisuhua,项目名称:phalcon-php,代码行数:15,代码来源:TagTest.php

示例10: indexAction

 public function indexAction()
 {
     if (!$this->request->isPost()) {
         Tag::setDefault('email', ' ');
         Tag::setDefault('password', '');
     } else {
         $name = trim($this->request->getPost('name', array('string', 'striptags')));
         $password = trim($this->request->getPost('password'));
         $password = sha1($password);
         $detail = Customer::find("name = " . $name);
         if ($password == sha1($detail->num)) {
             return $this->forward("search/jump");
         } else {
             $this->flash->error("错误");
         }
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:17,代码来源:SearchController.php

示例11: editAction

 /**
  * Edits a vehicle
  *
  * @param string $id
  */
 public function editAction($id)
 {
     if (!$this->request->isPost()) {
         $vehicle = Vehicles::findFirstById($id);
         if (!$vehicle) {
             $this->flash->error("vehicle was not found");
             return $this->dispatcher->forward(array("controller" => "vehicles", "action" => "index"));
         }
         $this->view->id = $vehicle->id;
         Tag::setDefault("id", $vehicle->id);
         Tag::setDefault("name", $vehicle->name);
         Tag::setDefault("maxCapacityMap", $vehicle->maxCapacityMap);
         Tag::setDefault("timeWindow", $vehicle->timeWindow);
         Tag::setDefault("maxWorkingTime", $vehicle->maxWorkingTime);
         Tag::setDefault("maxDrivingTime", $vehicle->maxDrivingTime);
         Tag::setDefault("status", $vehicle->status);
         Tag::setDefault("created", $vehicle->created);
         Tag::setDefault("modified", $vehicle->modified);
     }
 }
开发者ID:esironal,项目名称:sandbox-1,代码行数:25,代码来源:VehiclesController.php

示例12: editAction

 /**
  * Edits a waypoint
  *
  * @param string $id
  */
 public function editAction($id)
 {
     if (!$this->request->isPost()) {
         $waypoint = Waypoints::findFirstById($id);
         if (!$waypoint) {
             $this->flash->error("waypoint was not found");
             return $this->dispatcher->forward(array("controller" => "waypoints", "action" => "index"));
         }
         $this->view->id = $waypoint->id;
         Tag::setDefault("id", $waypoint->id);
         Tag::setDefault("name", $waypoint->name);
         Tag::setDefault("location", $waypoint->location);
         Tag::setDefault("latitude", $waypoint->latitude);
         Tag::setDefault("longitude", $waypoint->longitude);
         Tag::setDefault("deliveryMap", $waypoint->deliveryMap);
         Tag::setDefault("serviceTime", $waypoint->serviceTime);
         Tag::setDefault("timeWindows", $waypoint->timeWindows);
         Tag::setDefault("priority", $waypoint->priority);
         Tag::setDefault("status", $waypoint->status);
         Tag::setDefault("created", $waypoint->created);
         Tag::setDefault("modified", $waypoint->modified);
     }
 }
开发者ID:esironal,项目名称:sandbox-1,代码行数:28,代码来源:WaypointsController.php

示例13: registerAction

 public function registerAction()
 {
     $request = $this->request;
     if ($request->isPost()) {
         $full_name = $request->getPost('firstname', array('string', 'striptags')) . " " . $request->getPost('lastname', array('string', 'striptags'));
         $organisation_name = $request->getPost('organisation_name', array('string', 'striptags'));
         $email = $request->getPost('email', 'email');
         $password = $request->getPost('password');
         $repeat_password = $this->request->getPost('password2');
         if ($password != $repeat_password) {
             $this->flash->error("Passwords don't match");
             return $this->forward('session/register');
         }
         $organisation = new Organisation();
         $organisation->name = $organisation_name;
         $organisation->theme = 'make';
         if ($organisation->save() == true) {
             $config = new \Phalcon\Config\Adapter\Ini('/../app/config/config.ini');
             $database = new OrgDatabase();
             $database->db_host = $config->database->host;
             $database->db_username = "admin_" . $organisation_name;
             $database->db_password = sha1($password);
             $database->db_name = "db_" . $organisation_name;
             $database->organisation_id = $organisation->id;
             $user = new Users();
             $user->password = sha1($password);
             $user->full_name = $full_name;
             $user->role = 'Admin';
             $user->email = $email;
             $user->created_at = new \Phalcon\Db\RawValue('now()');
             $user->status = 'disable';
             $user->organisation_id = $organisation->id;
             if ($user->save() == false) {
                 foreach ($user->getMessages() as $message) {
                     $this->flash->error((string) $message);
                 }
             } else {
                 if ($database->save() == false) {
                     foreach ($database->getMessages() as $message) {
                         $this->flash->error((string) $message);
                     }
                 } else {
                     //Read the configuration
                     $host = $config->database->host;
                     $root = $config->database->username;
                     $root_password = $config->database->password;
                     $user = "admin_" . $organisation_name;
                     $pass = sha1($password);
                     $db = "db_" . $organisation_name;
                     Tag::setDefault('email', '');
                     Tag::setDefault('password', '');
                     $this->flash->success('Thanks for signing up for a new PRIME Dashboard, our consultants will contact you soon.');
                     return $this->forward('session/index');
                 }
             }
         } else {
             foreach ($organisation->getMessages() as $message) {
                 $this->flash->error((string) $message);
             }
         }
     }
 }
开发者ID:enricowillemse,项目名称:prime_admin,代码行数:62,代码来源:SessionController.php

示例14: editAction

 public function editAction($id)
 {
     $request = $this->request;
     if (!$request->isPost()) {
         $id = $this->filter->sanitize($id, array("int"));
         $Finance = Finance::findFirst('id="' . $id . '"');
         if (!$Finance) {
             $this->flash->error("这条记录没有找到!");
             return $this->forward("products/list");
         }
         $departments = Department::find();
         $this->view->setVar("departments", $departments);
         Tag::displayTo("company", $Finance->did);
         $typeArr;
         $type = Type::find();
         foreach ($type as $k => $v) {
             $types = Types::find("fid = '" . $v->id . "'");
             $typeArr[$v->name] = $types->toArray();
         }
         $this->view->setVar("typeArr", $typeArr);
         $this->view->setVar("id", $Finance->id);
         $datas = json_decode($Finance->data, true);
         foreach ($typeArr as $key => $val) {
             foreach ($val as $k => $v) {
                 if (isset($datas['cost'][$v['name']]) && $datas['cost'][$v['name']] != '') {
                     Tag::displayTo("cost[" . $v['name'] . "]", $datas['cost'][$v['name']]);
                 }
                 if (isset($datas['remark'][$v['name']]) && $datas['remark'][$v['name']] != '') {
                     Tag::displayTo("remark[" . $v['name'] . "]", $datas['remark'][$v['name']]);
                 }
                 if (isset($datas['limit'][$v['name']]) && $datas['limit'][$v['name']] != '') {
                     Tag::displayTo("limit[" . $v['name'] . "]", $datas['limit'][$v['name']]);
                 }
             }
         }
         Tag::displayTo("id", $Finance->id);
         $auth = $this->session->get("auth");
         if ($auth['did'] != 0) {
             Tag::setDefault("company", $auth['did']);
         }
         $this->view->setVar('did', $auth['did']);
         /*             
                     Tag::displayTo("product_types_id", $products->product_types_id);
                     Tag::displayTo("name", $products->name);
                     Tag::displayTo("price", $products->price);
                     Tag::displayTo("active", $products->active); 
                     $this->view->setVar("productTypes", ProductTypes::find());			
         */
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:50,代码来源:OperateController.php

示例15: beforeRender

 public function beforeRender($params)
 {
     Tag::setDefault($params['id'], $params['value']);
 }
开发者ID:moaljazaery,项目名称:phalcon-module-admin,代码行数:4,代码来源:ScalarField.php


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