public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $producttypes = ProductTypes::findFirst(array('id=:id:', 'bind' => array('id' => $id))); if (!$producttypes) { $this->flash->error("Product type to edit was not found"); return $this->forward("producttypes/index"); } $this->view->setVar("id", $producttypes->id); Tag::displayTo("id", $producttypes->id); Tag::displayTo("name", $producttypes->name); } }
public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $categories = Categories::findFirst(array('id = :id:', 'bind' => array('id' => $id))); if (!$categories) { $this->flash->error("The category was not found"); return $this->dispatcher->forward(array("controller" => "categories", "action" => "index")); } $this->view->setVar("id", $categories->id); Tag::displayTo("id", $categories->id); Tag::displayTo("name", $categories->name); Tag::displayTo("slug", $categories->slug); } }
public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $companies = Companies::findFirst(array('id=:id:', 'bind' => array('id' => $id))); if (!$companies) { $this->flash->error("companies was not found"); return $this->forward("companies/index"); } $this->view->setVar("id", $companies->id); Tag::displayTo("id", $companies->id); Tag::displayTo("name", $companies->name); Tag::displayTo("telephone", $companies->telephone); Tag::displayTo("address", $companies->address); Tag::displayTo("city", $companies->city); } }
public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $counts = Counts::findFirst('id="' . $id . '"'); if (!$counts) { $this->flash->error("counts was not found"); return $this->dispatcher->forward(array("controller" => "counts", "action" => "index")); } $this->view->setVar("id", $counts->id); Tag::displayTo("id", $counts->id); Tag::displayTo("links_id", $counts->links_id); Tag::displayTo("value", $counts->value); Tag::displayTo("visit_date", $counts->visit_date); Tag::displayTo("visitor_ip", $counts->visitor_ip); } }
public function editAction($id) { return true; $request = $this->request; if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $links = Links::findFirst('id="' . $id . '"'); if (!$links) { $this->flash->error("links was not found"); return $this->dispatcher->forward(array("controller" => "links", "action" => "index")); } $this->view->setVar("id", $links->id); Tag::displayTo("id", $links->id); Tag::displayTo("token", $links->token); Tag::displayTo("longurl", $links->longurl); Tag::displayTo("visitor_count", $links->visitor_count); } }
public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $products = Products::findFirst('id="' . $id . '"'); if (!$products) { $this->flash->error("products was not found"); return $this->forward("products/index"); } $this->view->setVar("id", $products->id); Tag::displayTo("id", $products->id); 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()); } }
public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $user = User::findFirst('id="' . $id . '"'); if (!$user) { $this->flash->error("user was not found"); return $this->dispatcher->forward(array("controller" => "user", "action" => "index")); } $this->view->setVar("id", $user->id); Tag::displayTo("id", $user->id); Tag::displayTo("username", $user->username); Tag::displayTo("fullname", $user->fullname); Tag::displayTo("email", $user->email); Tag::displayTo("password", $user->password); Tag::displayTo("role", $user->role); Tag::displayTo("active", $user->active); Tag::displayTo("last_login_time", $user->last_login_time); Tag::displayTo("create_time", $user->create_time); Tag::displayTo("update_time", $user->update_time); } }
public function editAction($id = null) { if (!$this->request->isPost() && !$this->request->isAjax()) { $id = $this->filter->sanitize($id, array("int")); $model = $this->loadModel($id); $this->view->setVar("id", $model->id); Tag::displayTo("name", $model->name); } elseif ($this->request->isPost() && !$this->request->isAjax()) { $id = $this->request->getPost('id', 'int'); $model = $this->loadModel($id); if (!$model->update($_POST)) { foreach ($model->getMessages() as $message) { $this->flashSession->error((string) $message->getMessage()); //echo var_dump($message->getType()); //echo var_dump($message->getMessage()); } return $this->response->redirect('backend/articleCategories/edit/' . $model->id); } else { $this->flashSession->success("Статья удачно обновлена"); return $this->response->redirect("backend/articleCategories"); } } }
public function editAction($id) { $request = $this->request; if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $insertion = Insertion::findFirst('id="' . $id . '"'); if (!$insertion) { $this->flash->error("insertion was not found"); return $this->dispatcher->forward(array("controller" => "insertion", "action" => "index")); } $this->view->setVar("id", $insertion->id); Tag::displayTo("id", $insertion->id); Tag::displayTo("category", $insertion->category); Tag::displayTo("body", $insertion->body); Tag::displayTo("status", $insertion->status); Tag::displayTo("price_range", $insertion->price_range); Tag::displayTo("price", $insertion->price); Tag::displayTo("buy_sell", $insertion->buy_sell); Tag::displayTo("create_user_id", $insertion->create_user_id); Tag::displayTo("update_user_id", $insertion->update_user_id); Tag::displayTo("create_time", $insertion->create_time); Tag::displayTo("update_time", $insertion->update_time); } }
public function editAction($id = null) { $this->assets->addCss('css/select2.css'); $this->assets->addJs('js/select2.js'); if (!$this->request->isPost() && !$this->request->isAjax()) { $id = $this->filter->sanitize($id, array("int")); $model = $this->loadModel($id); if (!$model) { $this->flashSession->error("Новость не найдена"); $this->response->redirect("backend/posts/index"); } $this->view->setVar("id", $model->id); $this->view->setVar('tags', \Models\Tags::getTagsForSelect()); Tag::displayTo("id", $model->id); Tag::displayTo("title", $model->title); Tag::displayTo("body", $model->body); Tag::displayTo("status", $model->status); Tag::displayTo("tags", $model->tags); } elseif ($this->request->isPost() && !$this->request->isAjax()) { $auth = $this->session->get('auth'); if (!$auth) { return $this->response->redirect(); } $id = $this->request->getPost('id', 'int'); $model = $this->loadModel($id); if (!$model) { $this->flashSession->error("Ничего не найдено"); $this->response->redirect("backend/posts/index"); } $model->author_id = $auth['id']; if (!$model->update($_POST)) { foreach ($model->getMessages() as $message) { $this->flashSession->error((string) $message->getMessage()); //echo var_dump($message->getType()); //echo var_dump($message->getMessage()); } return $this->response->redirect('backend/posts/edit/' . $model->id); } else { $this->flashSession->success("Запись удачно обновлена"); return $this->response->redirect("backend/posts"); } } }
/** * Runs the test for a Tag::$function with $options * * @param string $function * @param mixed $options * @param string $expected * @param boolean $xhtml * @param string $set */ public function testFieldParameter($function, $options, $expected, $xhtml, $set = '') { Tag::resetInput(); if ($xhtml) { Tag::setDocType(Tag::XHTML10_STRICT); $expected .= ' />'; } else { Tag::setDocType(Tag::HTML5); $expected .= '>'; } if ($set) { Tag::displayTo('x_name', 'x_value'); } $actual = Tag::$function($options); if ($set) { Tag::$set('x_name', ''); } $this->assertEquals($expected, $actual); }
public function editAction($id) { $this->assets->addJs('js/jquery.MultiFile.pack.js'); if (!$this->request->isPost() && !$this->request->isAjax()) { $id = $this->filter->sanitize($id, array("int")); $model = $this->loadModel($id); if (!$model) { $this->flashSession->error("Новость не найдена"); $this->response->redirect("backend/news/index"); } $this->view->setVar("id", $model->id); $this->view->setVar('images', $model->getImages()); Tag::displayTo("id", $model->id); Tag::displayTo("title", $model->title); Tag::displayTo("body", $model->body); Tag::displayTo("status", $model->status); } elseif ($this->request->isPost() && !$this->request->isAjax()) { $auth = $this->session->get('auth'); if (!$auth) { return $this->response->redirect(); } $id = $this->request->getPost('id', 'int'); $model = $this->loadModel($id); if (!$model) { $this->flashSession->error("Новость не найдена"); $this->response->redirect("backend/news/index"); } $model->update_user_id = $auth['id']; if (!$model->update($_POST)) { foreach ($model->getMessages() as $message) { $this->flashSession->error((string) $message->getMessage()); //echo var_dump($message->getType()); //echo var_dump($message->getMessage()); } return $this->response->redirect('backend/news/edit/' . $model->id); } else { $this->SaveImages($model); $this->flashSession->success("Новость удачно обновлена"); return $this->response->redirect("backend/news"); } } }
public function changetypesAction($id) { if ($id) { $newstype = Newstype::findFirst("id =" . $id); Tag::displayTo("id", $newstype->id); Tag::displayTo("name", $newstype->name); } else { $this->flash->error("错误"); } }
public function accountAction($id) { $id = $this->filter->sanitize($id, array("int")); $userInfo = Users::findFirst('did = "' . $id . '"'); if (!$userInfo) { $this->flash->notice("还木有帐号,请创建并保存"); $this->view->setVar("aid", $id); Tag::displayTo("did", $id); Tag::setDefault('email', ' '); Tag::setDefault('password', ''); $this->view->pick("session/register"); } else { $this->view->setVar("aid", $id); Tag::displayTo("id", $userInfo->id); Tag::displayTo("username", $userInfo->username); Tag::displayTo("name", $userInfo->name); Tag::displayTo("email", $userInfo->email); } }
public function newtypesAction($id) { Tag::displayTo("fid", $id); $this->view->form = $this->getForm(); }
/** * Edits an existing Profile * * @param int $id */ public function editAction($id) { if (!$this->request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $model = \Models\Roles::findFirst(array("conditions" => "id = ?1", "bind" => array(1 => "{$id}"))); if (!$model) { $this->flashSession->error("Такая роль не найдена"); return $this->response->redirect("backend/roles"); } Tag::displayTo("name", $model->name); Tag::displayTo("active", $model->active); $this->view->setVar("model", $model); } elseif ($this->request->isPost()) { $id = $this->request->getPost('id', 'int'); $model = \Models\Roles::findFirst("id = '{$id}'"); if (!$model) { $this->flashSession->error("Такая роль не найдена"); return $this->response->redirect("backend/roles/index"); } $model->assign(array('name' => $this->request->getPost('name', 'striptags'), 'active' => $this->request->getPost('active'))); if (!$model->save()) { $this->flash->error($model->getMessages()); } else { $this->flashSession->success("Данные о роли обновлены"); return $this->response->redirect("backend/roles"); } } }
public static function displayTo($id, $value) { parent::displayTo($id, $value); }
/** * Saves the user from the 'edit' action * */ public function editAction($id = null) { if (!$this->request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $model = \Models\Users::findFirst(array("conditions" => "id = ?1", "bind" => array(1 => "{$id}"))); if (!$model) { $this->flashSession->error("Такой пользователь не найден"); return $this->response->redirect("backend/users"); } Tag::displayTo("name", $model->name); Tag::displayTo("email", $model->email); Tag::displayTo("active", $model->active); Tag::displayTo("role_id", $model->role->id); Tag::displayTo("banned", $model->banned); Tag::displayTo("suspended", $model->suspended); $this->view->setVar("model", $model); } elseif ($this->request->isPost()) { $id = $this->request->getPost('id', 'int'); $model = \Models\Users::findFirst("id = '{$id}'"); if (!$model) { $this->flashSession->error("Такой пользователь не найден"); return $this->response->redirect("backend/users/index"); } $model->assign(array('name' => $this->request->getPost('name', 'striptags'), 'role_id' => $this->request->getPost('role_id', 'int'), 'email' => $this->request->getPost('email', 'email'), 'banned' => $this->request->getPost('banned'), 'suspended' => $this->request->getPost('suspended'), 'active' => $this->request->getPost('active'))); if (!$model->save()) { $this->flash->error($model->getMessages()); } else { $this->flashSession->success("Данные о пользователе обновлены"); return $this->response->redirect("backend/users"); } } }
/** * edit Action * * @param $id */ public function editAction($id) { $auth = $this->session->get('auth'); if ($auth) { $id = $this->filter->sanitize($id, array('int')); $player = Players::findFirst('id=' . $id); if (!$player) { $this->flash->error('Player not found'); $this->response->redirect('players/'); } if ($this->request->isPost()) { $this->setPlayer($player, $auth); if (!$player->save()) { foreach ($player->getMessages() as $message) { $this->flash->error((string) $message); } } else { $this->view->disable(); $this->flash->success('Player updated successfully'); // Invalidate the cache $this->cache->delete($this->getCacheHash('model')); $this->response->redirect('players/'); } } $this->view->setVar('id', $player->id); Tag::displayTo('id', $player->id); Tag::displayTo('name', $player->name); Tag::displayTo('active', $player->active); } }
/** * Tests selectStatic with setDefault to an non existent element * * @author Nikos Dimopoulos <*****@*****.**> * @since 2012-10-26 */ public function testSelectStaticDisplayToElementNotPresentXHTML() { $params = array('some_field_name', 'class' => 'some_class', 'size' => '10'); \Phalcon\Tag::displayTo('some_field', 'I'); $options = array('A' => 'Active', 'I' => 'Inactive'); $expected = '<select id="some_field_name" name="some_field_name" class="some_class" size="10">' . PHP_EOL . chr(9) . '<option value="A">Active</option>' . PHP_EOL . chr(9) . '<option value="I">Inactive</option>' . PHP_EOL . '</select>'; $actual = \Phalcon\Tag::selectStatic($params, $options); \Phalcon\Tag::displayTo('some_field', ''); $this->assertEquals($expected, $actual, sprintf($this->message, 'XHTML selectStatic with setDefault')); }
/** * edit Action * * @param integer $id */ public function editAction($id) { $auth = $this->session->get('auth'); if ($auth) { $id = $this->filter->sanitize($id, array('int')); $episode = Episodes::findFirst('id=' . $id); if (!$episode) { $this->flash->error('Episode not found'); return $this->response->redirect('episodes/'); } if ($this->request->isPost()) { $this->setEpisode($episode, $auth); if (!$episode->save()) { foreach ($episode->getMessages() as $message) { $this->flash((string) $message); } } else { $this->view->disable(); $this->flash->success('Episode updated successfully'); // Invalidate the cache $this->cache->delete($this->getCacheHash('model')); $this->response->redirect('episodes/'); } } $this->view->setVar('id', $episode->id); Tag::displayTo('id', $episode->id); Tag::displayTo('episode_id', $episode->number); Tag::displayTo('episode_date', $episode->air_date); Tag::displayTo('outcome', $episode->outcome); Tag::displayTo('summary', $episode->summary); } }