本文整理汇总了PHP中Date::formatted_time方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::formatted_time方法的具体用法?PHP Date::formatted_time怎么用?PHP Date::formatted_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::formatted_time方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_send
/**
* Отправка сообщения на Email
* @return void
*/
public function action_send()
{
$user = ORM::factory('user', $this->request->param('id', NULL));
if (!$user->loaded()) {
$this->request->redirect('admin');
}
$feedback_id = Arr::get($_GET, 'feedback', 0);
$email_from = array('no-reply' => 'no-reply@as-avtoservice.ru', 'sekretar' => 'sekretar@as-avtoservice.ru');
if ($_POST) {
$message = ORM::factory('message');
$message->values($_POST, array('title', 'text', 'from'));
$message->user_id = $user->id;
$message->feedback_id = $feedback_id;
$message->date = Date::formatted_time();
try {
$message->save();
$this->add_to_email_queue($user->id, $message->id, $message->from);
Message::set(Message::SUCCESS, 'Сообщения пользователю "' . $user->username . '" отправлено в очередь на отправку');
$this->request->redirect('admin/message');
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
}
$this->view = View::factory('backend/message/send')->set('values', $this->values)->set('errors', $this->errors)->set('email_from', $email_from)->set('user', $user);
$this->template->title = 'Отправка сообщения';
$this->template->bc['#'] = $this->template->title;
$this->template->content = $this->view;
}
示例2: format_message
public function format_message(array $message, $format = "time --- level: body")
{
$message['time'] = Date::formatted_time('@' . $message['time']);
$message['level'] = $this->_log_levels[$message['level']];
$string = strtr($format, $message);
return $string;
}
示例3: action_createOrDeleteAccess
public function action_createOrDeleteAccess()
{
try {
$post = Validate::factory($_POST)->rule('menu_id', 'not_empty')->rule('group_id', 'not_empty');
if (!$post->check()) {
echo "0|ERROR - Empty Data Post";
die;
}
$menu_id = $_POST['menu_id'];
$group_id = $_POST['group_id'];
$privilege = new Model_Privilege();
$privilege = ORM::factory('Privilege')->where('idMenu', '=', $menu_id)->where('idGroup', '=', $group_id)->find();
if ($privilege->loaded() == TRUE) {
$privilege->delete();
} else {
$privilege->idMenu = $menu_id;
$privilege->idGroup = $group_id;
$privilege->grantDate = Date::formatted_time();
$privilege->idUser = $this->getSessionParameter('user_id');
$privilege->save();
}
echo "1|ok";
} catch (Exception $exc) {
echo "0|" . $exc->getTraceAsString();
}
die;
}
示例4: action_edit
/**
* Редактирование контента
* @return void
*/
public function action_edit()
{
$content = ORM::factory('content_site', $this->request->param('id', NULL));
if (!$content->loaded()) {
Message::set(Message::ERROR, Kohana::message('admin', 'content_not_found'));
$this->request->redirect('admin/content/portal');
}
$this->values = $content->as_array();
if ($_POST) {
$active = Arr::get($_POST, 'active', 0);
try {
$content->values($_POST, array('title', 'url', 'keywords', 'description', 'text'));
$content->active = $active;
$content->date = Date::formatted_time();
$content->update();
$this->route_update();
Message::set(Message::SUCCESS, 'Страница "' . $content->title . '" отреакдтирована');
$this->request->redirect('admin/content/portal');
} catch (ORM_Validation_Exception $e) {
$this->values = $_POST;
$this->errors = $e->errors('models');
}
}
$this->view = View::factory('backend/content/portal/form')->set('values', $this->values)->set('errors', $this->errors)->set('url', 'admin/content/portal/edit/' . $this->request->param('id'));
$this->template->title = 'Добавление страницы';
$this->template->bc['#'] = $this->template->title;
$this->template->content = $this->view;
}
示例5: action_edit
function action_edit()
{
$vacancy = ORM::factory('vacancy', $this->request->param('id', NULL));
if (!$vacancy->loaded() or $vacancy->user_id != $this->user->id) {
Message::set(Message::ERROR, Kohana::message('cabinet', 'vacancy_not_found'));
$this->request->redirect('cabinet/vacancy');
}
$services = array();
foreach ($this->user->services->find_all() as $service) {
$services[$service->id] = $service->name;
}
if ($_POST) {
try {
$vacancy->values($_POST, array('title', 'text', 'service_id'));
$vacancy->user_id = $this->user->id;
$vacancy->active = 1;
$vacancy->date = Date::formatted_time();
$vacancy->update();
// Обновляем дату редактирования у компании
DB::update('services')->set(array('date_edited' => Date::formatted_time()))->where('id', '=', $vacancy->service_id)->execute();
Message::set(Message::SUCCESS, 'Вакансия успешно отредактирована');
$this->request->redirect('cabinet/vacancy');
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
} else {
$this->values = $vacancy->as_array();
}
$this->view = View::factory('frontend/cabinet/vacancy/form')->set('url', 'cabinet/vacancy/edit/' . $vacancy->id)->set('services', $services)->set('values', $this->values)->set('errors', $this->errors);
$this->template->title = $this->site_name . 'Редактирование вакансии';
$this->template->bc['#'] = 'Редактирование вакансии';
$this->template->content = $this->view;
}
示例6: action_edit
/**
* Редактирование новости автомира
* @return void
*/
public function action_edit()
{
$news = ORM::factory('newsworld', $this->request->param('id', NULL));
if (!$news->loaded()) {
Message::set(Message::ERROR, Kohana::message('admin', 'news_not_found'));
$this->request->redirect('admin/news/world');
}
if ($_POST) {
$active = Arr::get($_POST, 'active', 0);
try {
$news->values($_POST, array('title', 'text'));
$news->active = $active;
$news->date = Date::formatted_time();
$news->update();
Message::set(Message::SUCCESS, 'Новость автомира "' . $news->title . '" отредактирована');
$this->request->redirect('admin/news/world');
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
} else {
$this->values = $news->as_array();
}
$this->view = View::factory('backend/news/form')->set('errors', $this->errors)->set('values', $this->values)->set('url', 'admin/news/world/edit/' . $news->id);
$this->template->title = 'Редактирование новости автомира "' . $news->title . '"';
$this->template->bc['#'] = $this->template->title;
$this->template->content = $this->view;
}
示例7: action_index
function action_index()
{
if ($_POST) {
$feedback = ORM::factory('feedback');
try {
$feedback->values($_POST, array('title', 'text'));
$feedback->type = 1;
$feedback->user_id = $this->user->id;
$feedback->date = Date::formatted_time();
$feedback->save();
$email_view = View::factory('email/feedback')->set('username', $this->user->username)->set('title', $feedback->title)->set('text', $feedback->text)->render();
Email::send('sekretar@as-avtoservice.ru', array('no-reply@as-avtoservice.ru', 'Ассоциация автосервисов'), $feedback->title, $email_view, TRUE);
Message::clear();
Message::set(Message::SUCCESS, 'Спасибо! Ваше сообщение отправлено администрации сайта');
$this->request->redirect('cabinet');
} catch (ORM_Validation_Exception $e) {
Message::set(Message::ERROR, 'Произошла ошибка при отправке сообщения');
$this->errors = $e->errors('models');
$this->values = $_POST;
}
}
$this->view = View::factory('frontend/cabinet/feedback/create_feedback')->set('errors', $this->errors)->set('values', $this->values);
$this->template->title = 'Обратная связь';
$this->template->content = $this->view;
}
示例8: action_createOrUpdateDiscount
public function action_createOrUpdateDiscount()
{
try {
$post = Validate::factory($_POST)->rule('discount_value', 'not_empty');
if (!$post->check()) {
echo "0|ERROR";
die;
}
$dicount_value = $_POST['discount_value'];
$discount_id = $_POST['discount_id'];
$discount = new Model_Discount();
if ($discount_id != 0) {
$discount = ORM::factory('Discount', $discount_id);
} else {
$discount->registrationDate = Date::formatted_time();
}
$discount->discount = trim($dicount_value);
$discount->status = $this->GENERAL_STATUS['ACTIVE'];
$discount->save();
echo "1|ok";
} catch (Exception $exc) {
echo "0|" . $exc->getTraceAsString();
}
die;
}
示例9: action_edit
function action_edit()
{
$stock = ORM::factory('stock', $this->request->param('id', NULL));
if (!$stock->loaded() or $stock->user_id != $this->user->id) {
$this->request->redirect('cabinet/stock');
}
$services = array();
foreach ($this->user->services->find_all() as $service) {
$services[$service->id] = $service->name;
}
if ($_POST) {
try {
$stock->values($_POST, array('text', 'service_id'));
$stock->update();
// Обновляем дату редактирования у компании
DB::update('services')->set(array('date_edited' => Date::formatted_time()))->where('id', '=', $stock->service_id)->execute();
Message::set(Message::SUCCESS, 'Акция отредактирована');
$this->request->redirect('cabinet/stock');
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
} else {
$this->values = $stock->as_array();
}
$this->view = View::factory('frontend/cabinet/stock/form')->set('url', 'cabinet/stock/edit/' . $stock->id)->set('values', $this->values)->set('errors', $this->errors)->set('services', $services);
$this->template->title = $this->site_name . 'Редактирование акции';
$this->template->bc['#'] = 'Редактирование акции';
$this->template->content = $this->view;
}
示例10: action_view
function action_view()
{
$open_coupon = Arr::get($_GET, 'print_coupon', FALSE);
$service = ORM::factory('service', $this->request->param('id', NULL));
if (!$service->loaded() || !$service->active) {
Message::set(Message::ERROR, 'Такой сервис не найден');
$this->request->redirect('/');
}
$this->validation = Validation::factory($_POST)->rule('antibot', 'not_empty');
if ($_POST) {
$review = ORM::factory('review');
try {
$review->values($_POST, array('text', 'email'));
$review->date = Date::formatted_time();
$review->service_id = $service->id;
$review->active = 0;
//$review->user_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
$review->save($this->validation);
Message::set(Message::SUCCESS, Kohana::message('success_msg', 'review_created'));
$this->request->redirect('services/' . $service->id);
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
}
$this->view = View::factory('frontend/services/view_service')->set('service', $service)->set('open_coupon', $open_coupon)->set('coupon_frame', HTML::iframe('services/get_coupon/' . $service->id, 'coupon_frame'))->set('values', $this->values)->set('errors', $this->errors);
$this->template->bc['/'] = 'Главная';
$this->template->bc['#'] = $service->name;
$this->template->title = 'Автосервис ' . $service->name . ' ' . $service->about;
$this->template->meta_description = strip_tags($service->about);
$this->add_js('http://api-maps.yandex.ru/1.1/index.xml?key=' . $this->settings['YMaps_key'] . '&onerror=map_alert');
$this->add_js('assets/js/maps_detail.js');
$this->add_js('assets/share42/share42.js');
$this->template->content = $this->view;
}
示例11: action_edit
/**
* Редактирование страницы фильтра
* @return void
*/
public function action_edit()
{
$content = ORM::factory('content_filter', $this->request->param('id', NULL));
if (!$content->loaded()) {
Message::set(Message::ERROR, Kohana::message('admin', 'content_not_found'));
$this->request->redirect('admin/content/filter');
}
// Город страницы
$city = $content->city->name;
$type = __('filter_type_' . $content->type);
if ($_POST) {
try {
$content->text = Arr::get($_POST, 'text', NULL);
$content->date_edited = Date::formatted_time();
$content->update();
Message::set(Message::SUCCESS, 'Страница фильтра для города ' . $city . ' успешно отредактирована');
$this->request->redirect('admin/content/filter/index/' . $content->type);
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
} else {
$this->values = $content->as_array();
}
$this->view = View::factory('backend/content/filter/edit')->set('url', 'admin/content/filter/edit/' . $content->id)->set('city', $city)->set('type', $type)->set('values', $this->values)->set('errors', $this->errors);
$this->template->title = 'Редактирование страницы фильтра для г. ' . $city;
$this->template->bc['#'] = $this->template->title;
$this->template->content = $this->view;
}
示例12: action_add
public function action_add()
{
$cities = ORM::factory('city')->get_cities();
$services = ORM::factory('service')->get_services_as_array();
if ($_POST) {
if (isset($_POST['city_id']) and $_POST['city_id'] != 0) {
$services = ORM::factory('service')->get_services_as_array(array('city_id' => $_POST['city_id']));
}
$review = ORM::factory('review');
try {
$review->values($_POST, array('name', 'email', 'text', 'service_id'));
if ($this->user) {
$review->user_id = $this->user->id;
}
$review->active = 0;
$review->date = Date::formatted_time();
$review->save();
Message::set(Message::SUCCESS, __('review_adding_complete'));
$this->request->redirect('reviews');
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
}
$this->view = View::factory('frontend/review/add')->set('values', $this->values)->set('errors', $this->errors)->set('cities', $cities)->set('services', $services);
$this->template->title = 'Написать отзыв';
$this->template->bc['#'] = $this->template->title;
$this->template->content = $this->view;
}
示例13: action_index
public function action_index()
{
$company_pages_hits = array();
$company = ORM::factory('service');
foreach ($company->find_all() as $c) {
foreach ($c->visits->find_all() as $visit) {
if (!array_key_exists(Date::formatted_time($visit->date, 'Y-m-d H'), $company_pages_hits)) {
$company_pages_hits[Date::formatted_time($visit->date, 'Y-m-d H')] = 1;
} else {
$company_pages_hits[Date::formatted_time($visit->date, 'Y-m-d H')] += 1;
}
}
}
ksort($company_pages_hits);
$company_pages_hits_line = array();
foreach ($company_pages_hits as $date => $hints) {
$company_pages_hits_line[] = array($date . ':00 PM', $hints);
}
$this->add_js('assets/js/jqplot/plugins/jqplot.highlighter.min.js');
$this->add_js('assets/js/jqplot/plugins/jqplot.cursor.min.js');
$this->add_js('assets/js/jqplot/plugins/jqplot.dateAxisRenderer.min.js');
$this->add_js('assets/js/jqplot/plugins/jqplot.pointLabels.min.js');
$this->template->content = View::factory('backend/statistics/total_chart')->set('company_line', json_encode($company_pages_hits_line));
FirePHP::getInstance(TRUE)->log($company_pages_hits);
}
示例14: action_index
function action_index()
{
$services[0] = 'Выбрать компанию';
foreach ($this->user->services->find_all() as $service) {
$services[$service->id] = $service->name;
}
if ($_POST) {
$feedback = ORM::factory('feedback');
try {
$feedback->values($_POST, array('title', 'text'));
$feedback->type = 2;
$feedback->user_id = $this->user->id;
$feedback->service_id = Arr::get($_POST, 'service_id', 0);
$feedback->date = Date::formatted_time();
$feedback->save();
$email_view = View::factory('email/adv')->set('username', $this->user->username)->set('title', $feedback->title)->set('text', $feedback->text);
if ($feedback->service_id != 0) {
$email_view->set('service', $this->user->services->where('id', '=', $feedback->service_id)->find());
}
$email_view->render();
Email::send('sekretar@as-avtoservice.ru', array('no-reply@as-avtoservice.ru', 'Ассоциация автосервисов'), $feedback->title, $email_view, TRUE);
Message::set(Message::SUCCESS, 'Спасибо! Ваше заявка принята на рассмотрение администрацией сайта');
$this->request->redirect('cabinet');
} catch (ORM_Validation_Exception $e) {
$this->errors = $e->errors('models');
$this->values = $_POST;
}
}
$this->view = View::factory('frontend/cabinet/adv/create_blank')->set('services', $services)->set('errors', $this->errors)->set('values', $this->values);
$this->template->title = 'Реклама на сайте';
$this->template->bc['#'] = $this->template->title;
$this->template->content = $this->view;
}
示例15: action_activate
/**
* Mark advertisement as active : STATUS = 1
*/
public function action_activate()
{
$user = Auth::instance()->get_user();
$id = $this->request->param('id');
if (isset($id)) {
$active_ad = new Model_Ad($id);
if ($active_ad->loaded()) {
$activate = FALSE;
//admin whatever he wants
if ($user->is_admin()) {
$activate = TRUE;
} elseif ($user->id_user == $active_ad->id_user and !in_array(core::config('general.moderation'), Model_Ad::$moderation_status)) {
$activate = TRUE;
} else {
Alert::set(Alert::ALERT, __("This is not your advertisement."));
}
//its not published
if ($active_ad->status == Model_Ad::STATUS_PUBLISHED) {
$activate = FALSE;
Alert::set(Alert::ALERT, __("Advertisement is already marked as 'active'"));
}
//expired but cannot reactivate option
if (Core::config('advertisement.expire_reactivation') == FALSE and core::config('advertisement.expire_date') > 0 and Date::formatted_time($active_ad->published . '+' . core::config('advertisement.expire_date') . ' days') < Date::formatted_time()) {
$activate = FALSE;
Alert::set(Alert::ALERT, __("Advertisement can not be marked as “active”. It's expired."));
}
//pending payment
if ($activate === TRUE and ($order = $active_ad->get_order()) !== FALSE and $order->status == Model_Order::STATUS_CREATED) {
$activate = FALSE;
Alert::set(Alert::ALERT, __("Advertisement can not be marked as “active”. There is a pending payment."));
}
//activate the ad
if ($activate === TRUE) {
$active_ad->published = Date::unix2mysql(time());
$active_ad->status = Model_Ad::STATUS_PUBLISHED;
try {
$active_ad->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
} else {
HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index')));
}
} else {
//throw 404
throw HTTP_Exception::factory(404, __('Page not found'));
}
}
// send confirmation email
$cat = new Model_Category($active_ad->id_category);
$usr = new Model_User($active_ad->id_user);
if ($usr->loaded()) {
//we get the QL, and force the regen of token for security
$url_ql = $usr->ql('ad', array('category' => $cat->seoname, 'seotitle' => $active_ad->seotitle), TRUE);
$ret = $usr->email('ads-activated', array('[USER.OWNER]' => $usr->name, '[URL.QL]' => $url_ql, '[AD.NAME]' => $active_ad->title));
}
Alert::set(Alert::SUCCESS, __('Advertisement is active and published'));
HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index')));
}