本文整理汇总了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');
}
}
示例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");
}
}
示例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('更新成功');
}
}
}
示例4: indexAction
public function indexAction()
{
if (!$this->request->isPost()) {
Tag::setDefault('email', 'demo@phalconphp.com');
Tag::setDefault('password', 'phalcon');
}
}
示例5: indexAction
public function indexAction()
{
if (!$this->request->isPost()) {
Tag::setDefault('email', ' ');
Tag::setDefault('password', '');
}
}
示例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');
}
}
}
示例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'));
}
示例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);
}
示例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);
}
示例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("错误");
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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());
*/
}
}
示例15: beforeRender
public function beforeRender($params)
{
Tag::setDefault($params['id'], $params['value']);
}