本文整理汇总了PHP中Phalcon\Tag类的典型用法代码示例。如果您正苦于以下问题:PHP Tag类的具体用法?PHP Tag怎么用?PHP Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize()
{
Tag::prependTitle('Fireball | ');
$this->assets->collection('style')->addCss('third-party/css/bootstrap.min.css', false, false)->addCss('css/style.css')->setTargetPath('css/production.css')->setTargetUri('css/production.css')->join(true)->addFilter(new \Phalcon\Assets\Filters\Cssmin());
//takes the js or css files and combines / minifies them for faster page loads
$this->assets->collection('js')->addJs('third-party/js/jquery-1.12.0.min.js', false, false)->addJs('third-party/js/bootstrap.min.js', false, false)->setTargetPath('js/production.js')->setTargetUri('js/production.js')->join(true)->addFilter(new \Phalcon\Assets\Filters\Jsmin());
}
示例2: initialize
public function initialize()
{
$this->view->setTemplateAfter('main');
$this->view->hdr = 'Купоны';
Tag::setTitle('Coupons Panel');
parent::initialize();
}
示例3: initialize
public function initialize()
{
\Phalcon\Tag::setTitle('登录');
parent::initialize();
$this->view->setTemplateAfter('login_register');
$this->operation = new UserOperation($this->di);
}
示例4: editAction
public function editAction($id)
{
$fileStore = FileStore::findFirst($id);
if ($fileStore == false) {
$this->flash->error(_("Document was not found"));
return $this->dispatcher->forward(array('action' => 'index'));
}
$request = $this->request;
$userId = $this->auth->getIdentity();
$form = new FileStoreForm($fileStore, array('edit' => true));
if ($request->isPost()) {
if ($form->isValid($request->getPost()) == true && $request->hasFiles() == true) {
$fileStore = new FileStore();
foreach ($request->getUploadedFiles() as $file) {
$fileStore->assign(array('id' => $id, 'fileName' => $file->getName(), 'fileCaption' => $request->getPost('fileCaption'), 'description' => $request->getPost('description'), 'categoriesId' => $request->getPost('categoriesId'), 'userId' => $userId['id'], 'mimeType' => $file->getType(), 'fileData' => file_get_contents($file->getTempName())));
if ($fileStore->update() == true) {
$this->flash->success(_("Update Document success"));
Tag::resetInput();
return $this->dispatcher->forward(array('action' => 'index'));
}
$this->flash->error($fileStore->getMessages());
}
}
}
$this->view->form = $form;
}
示例5: indexAction
/**
* The index action
*/
public function indexAction()
{
if (!$this->request->isPost()) {
Tag::setDefault('username', 'user@email.com');
Tag::setDefault('password', 'hhf');
}
}
示例6: 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");
}
}
示例7: outputCss
/**
* Prints the HTML for CSS resources
*
* @param string $collectionName the name of the collection
*
* @return string the result of the collection
**/
public function outputCss($collectionName = null)
{
$collection = $this->collection($collectionName);
if ($collection->getJoin()) {
$filename = $collection->getTargetPath();
if (file_exists($filename)) {
$time = 0;
foreach ($collection->getResources() as $resource) {
$tmp = filemtime($resource->getRealTargetPath());
if ($tmp > $time) {
$time = $tmp;
}
}
// If created
if (filemtime($filename) > $time) {
$collection->setTargetUri($collection->getTargetUri() . '?' . filemtime($filename));
return Tag::stylesheetLink($collection->getTargetUri());
}
}
// Else CREATE
$res = parent::outputCss($collectionName);
return $res;
}
return parent::outputCss($collectionName);
}
示例8: statisticAction
public function statisticAction()
{
$id = $this->dispatcher->getParam('id');
$banner = Banners::findFirst($id);
if ($id && $banner && $banner->advertiser_id == $this->auth->get_user()->id) {
$this->assets->collection('bottom-js')->addJs('js/moment/moment.min.js')->addJs('js/moment/ru.js')->addJs('js/datetimepicker/js/bootstrap-datetimepicker.js');
$this->assets->collection('css')->addCss('js/datetimepicker/css/bootstrap-datetimepicker.min.css');
if (!$this->request->getQuery('start_date')) {
if (!empty($banner->start_date)) {
$start_date = $banner->start_date;
} else {
$first_view = $banner->views->getFirst()->date;
if (!empty($first_view)) {
$start_date = $first_view;
} else {
$start_date = 0;
}
}
} else {
$start_date = date_parse_from_format('d.m.Y H:i', $this->request->getQuery('start_date'));
$start_date = mktime($start_date['hour'], $start_date['minute'], 0, $start_date['month'], $start_date['day'], $start_date['year']);
}
if (!$this->request->getQuery('end_date')) {
if (!empty($banner->end_date)) {
if ($banner->end_date > time()) {
$end_date = time();
} else {
$end_date = $banner->end_date;
}
} else {
$end_date = time();
}
} else {
$end_date = date_parse_from_format('d.m.Y H:i', $this->request->getQuery('end_date'));
$end_date = mktime($end_date['hour'], $end_date['minute'], 0, $end_date['month'], $end_date['day'], $end_date['year']);
}
$days = floor(($end_date + 10800) / 86400) - floor(($start_date + 10800) / 86400) + 1;
$days_arr = [];
if ($days > 0) {
for ($i = 0; $i < $days; $i++) {
$day = floor(($start_date + 10800) / 86400) * 86400 + $i * 86400 - 10800;
if ((!empty($banner->start_date) ? $day >= floor(($banner->start_date + 10800) / 86400) * 86400 - 10800 : true) && $day < (!empty($banner->end_date) ? $banner->end_date : time())) {
$days_arr[] = array('date' => $day, 'views' => $banner->countViews("date >= {$day} AND date < " . ($day + 86400)), 'clicks' => $banner->countViews("date >= {$day} AND date < " . ($day + 86400) . " AND clicked = 1"));
}
}
}
$this->view->days = $days_arr;
$q = "date >= {$start_date} AND date <= {$end_date}";
$this->view->views = $banner->countViews(array($q));
$q .= " AND clicked = 1";
$this->view->clicks = $banner->countViews(array($q));
$this->view->start_date = $start_date;
$this->view->end_date = $end_date;
$this->view->banner = $banner;
$this->view->title = "Статистика для баннера \"{$banner->name}\"";
\Phalcon\Tag::prependTitle("Статистика для баннера \"{$banner->name}\"");
} else {
$this->dispatcher->forward(array("namespace" => 'App\\Controllers', "controller" => "error", "action" => "notFound"));
}
}
示例9: 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('更新成功');
}
}
}
示例10: initialize
public function initialize()
{
Tag::setTitle('About');
parent::initialize();
$this->_bc->add('About', 'about');
$this->view->setVar('menus', $this->constructMenu($this));
}
示例11: run
public function run()
{
$this->assets->outputCss();
$this->assets->outputJs();
echo Tag::textArea(array("{$this->id}", "name" => "{$this->name}"));
echo '<div class="hint"><a onclick="return setupElrteEditor(\'' . $this->id . '\', this, \'' . $this->theme . '\', \'' . $this->height . '\');">WYSIWYG</a></div>';
}
示例12: initialize
protected function initialize()
{
\Phalcon\Tag::prependTitle('PRIME | ');
$this->view->setViewsDir('../app/views/');
$this->view->setLayoutsDir('/layouts/');
$this->view->setTemplateAfter('main');
}
示例13: run
public function run()
{
$faker = Faker::create();
$log = new Stream('php://stdout');
$log->info('Start ' . __CLASS__);
/** @var Phalcon\Db\AdapterInterface $database */
$database = $this->getDI()->get('db');
$database->begin();
for ($i = 0; $i <= self::TAGS_TOTAL; $i++) {
$title = $faker->company;
$description = $faker->text;
$tags = new Tags();
$tags->name = $title;
$tags->slug = \Phalcon\Tag::friendlyTitle($title);
$tags->numberPosts = 0;
$tags->noBounty = 'N';
$tags->noDigest = 'N';
$tags->description = $description;
if (!$tags->save()) {
var_dump($tags->getMessages());
$database->rollback();
die;
}
$log->info('tags: ' . $tags->getName());
}
}
示例14: loginAction
/**
* Starts a session in the admin backend
*/
public function loginAction()
{
\Phalcon\Tag::appendTitle(" - Вход");
$form = new LoginForm();
try {
if (!$this->request->isPost()) {
if ($this->auth->hasRememberMe()) {
return $this->auth->loginWithRememberMe();
}
} else {
if ($form->isValid($this->request->getPost()) == false) {
foreach ($form->getMessages() as $message) {
$this->flash->error($message);
}
} else {
$this->auth->check(array('email' => $this->request->getPost('email', 'email'), 'password' => $this->request->getPost('password'), 'remember' => $this->request->getPost('remember')));
$auth = $this->session->get('auth');
$this->flashSession->notice($auth['role']);
if (!$auth) {
$this->flashSession->notice("Нужно войти или зарегистрироваться");
return $this->response->redirect("session/login");
}
if ($auth['role'] == 'Administrators') {
$this->flashSession->success("Здравствуйте администратор. Вы находитесь в области управления сайтом, в разделе Новости.");
return $this->response->redirect("backend/news");
}
return $this->response->redirect();
}
}
} catch (AuthException $e) {
$this->flash->error($e->getMessage());
}
$this->view->form = $form;
}
示例15: initialize
/**
* 初始化
*/
protected function initialize()
{
parent::initialize();
//Prepend the application name to the title
\Phalcon\Tag::prependTitle('Blog | ');
$this->view->setTemplateAfter('common');
}