/**
  * @return Feeding
  */
 public function getInProgressOrNew()
 {
     $feeding = $this->getInProgress();
     if ($feeding instanceof NullFeeding) {
         $feeding = new Feeding();
         $feeding->setDateTime($this->dateHelper->now());
         $feeding->setStatus(Feeding::STATUS_InProgress);
     }
     return $feeding;
 }
Exemple #2
0
 public static function getTweets($twitter_user)
 {
     $i = 0;
     $twitter_url = 'http://twitter.com/statuses/user_timeline/' . $twitter_user . '.xml?count=4';
     $tweets = array();
     if ($buffer = @file_get_contents($twitter_url)) {
         libxml_use_internal_errors();
         try {
             $xml = @new \SimpleXMLElement($buffer);
             if ($xml->status) {
                 foreach ($xml->status as $status) {
                     $tweet = $status->text;
                     $date = $status->created_at;
                     $id = $status->id;
                     //Turn all urls, hastags, and @mentions into links
                     $tweet = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\">\\2</a>", $tweet);
                     $tweet = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\">\\2</a>", $tweet);
                     $tweet = preg_replace("/@(\\w+)/", "<a href=\"http://twitter.com/\\1\">@\\1</a>", $tweet);
                     $tweet = preg_replace("/#(\\w+)/", "<span class='twitter_hash'><a href=\"http://search.twitter.com/search?q=\\1\">#\\1</a></span>", $tweet);
                     $formatted_date = DateHelper::formatDate($date);
                     $tweets[$i]['tweet'] = $tweet;
                     $tweets[$i]['date'] = $formatted_date;
                     $i++;
                 }
             }
         } catch (\Exception $e) {
         }
     }
     return $tweets;
 }
 function exportPDF()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     AImporter::helper('pdf', 'date');
     AImporter::model('transportreports');
     $model = new BookproModelTransportReports();
     $depart_date = DateHelper::createFromFormatYmd($input->get('filter_depart_date'));
     $state = $model->getState();
     $state->set('list.limit', NULL);
     $state->set('list.start', 0);
     $state->set('list.ordering', 'pickup');
     $state->set('list.direction', 'ASC');
     if ($app->isAdmin()) {
         $ticket_view = $this->getView('Transportreports', 'html', 'BookProView');
     } else {
         $ticket_view = $this->getView('AgentTransportreports', 'html', 'BookProView');
         $ticket_view->is_admin = 1;
     }
     $ticket_view->setModel($model, true);
     $ticket_view->setLayout('report');
     ob_start();
     $ticket_view->display();
     $pdf = ob_get_contents();
     ob_end_clean();
     //get flight name
     $order = new JObject();
     $order->name = "transport_report" . $input->get('filter_depart_date') . '_' . JHtml::_('date', 'now', 'YmdHis');
     $order->fontsize = 9;
     PrintPdfHelper::printTicket($pdf, $order, 'P');
     return;
 }
 protected function populateState($ordering = null, $direction = null)
 {
     // Load the filter state.
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $order_status = $this->getUserStateFromRequest($this->context . '.filter.order_status', 'filter_order_status', null, 'string');
     $this->setState('filter.order_status', $order_status);
     $from_time = $this->getUserStateFromRequest($this->context . '.filter.from_time', 'filter_from_time', null, 'string');
     $this->setState('filter.from_time', $from_time);
     $to_time = $this->getUserStateFromRequest($this->context . '.filter.to_time', 'filter_to_time', null, 'string');
     $this->setState('filter.to_time', $to_time);
     $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', null, 'int');
     $this->setState('filter.type', $type);
     $destfrom = $this->getUserStateFromRequest($this->context . '.filter.destfrom', 'filter_destfrom', null, 'int');
     $this->setState('filter.destfrom', $destfrom);
     $destto = $this->getUserStateFromRequest($this->context . '.filter.destto', 'filter_destto', null, 'int');
     $this->setState('filter.destto', $destto);
     $route_id = $this->getUserStateFromRequest($this->context . '.filter.route_id', 'filter_route_id', null, 'int');
     $this->setState('filter.route_id', $route_id);
     parent::populateState('i.start', 'ASC');
     $fromdate = $this->getUserStateFromRequest($this->context . '.filter.from_date', 'filter_from_date', null, 'string');
     $fromdate = DateHelper::createFromFormatYmd($fromdate);
     $this->setState('filter.from_date', $fromdate);
     $todate = $this->getUserStateFromRequest($this->context . '.filter.to_date', 'filter_to_date', null, 'string');
     $todate = DateHelper::createFromFormatYmd($todate);
     $this->setState('filter.to_date', $todate);
 }
 protected function populateState($ordering = null, $direction = null)
 {
     AImporter::helper('date');
     parent::populateState();
     $app = JFactory::getApplication();
     $id = JRequest::getVar('id', 0, '', 'int');
     $this->setState('passengerlist.id', $id);
     // Load the filter state.
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $order_id = $this->getUserStateFromRequest($this->context . '.filter.order_id', 'filter_order_id', null, 'int');
     $this->setState('filter.order_id', $order_id);
     $tour_id = $this->getUserStateFromRequest($this->context . '.filter.tour_id', 'filter_tour_id', null, 'int');
     $this->setState('filter.tour_id', $tour_id);
     $depart_date = $this->getUserStateFromRequest($this->context . '.filter.depart_date', 'filter_depart_date', null);
     $depart_date = DateHelper::createFromFormatYmd($depart_date);
     $this->setState('filter.depart_date', $depart_date);
     $order_status = $this->getUserStateFromRequest($this->context . '.filter.order_status', 'filter_order_status', null, 'string');
     $this->setState('filter.order_status', $order_status);
     $value = $app->getUserStateFromRequest($this->context . '.ordercol', 'filter_order', $ordering);
     $this->setState('list.ordering', $value);
     $value = $app->getUserStateFromRequest($this->context . '.orderdirn', 'filter_order_Dir', $direction);
     $this->setState('list.direction', $value);
     $fromdate = $this->getUserStateFromRequest($this->context . '.filter.from_date', 'filter_from_date', null, 'string');
     $fromdate = DateHelper::createFromFormatYmd($fromdate);
     $this->setState('filter.from_date', $fromdate);
     $todate = $this->getUserStateFromRequest($this->context . '.filter.to_date', 'filter_to_date', null, 'string');
     $todate = DateHelper::createFromFormatYmd($todate);
     $this->setState('filter.to_date', $todate);
 }
 function getContent()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $content = '';
     if ($this->rss_url) {
         require_once 'common/rss/libs/SimplePie/simplepie.inc';
         if (!is_dir($GLOBALS['codendi_cache_dir'] . '/rss')) {
             mkdir($GLOBALS['codendi_cache_dir'] . '/rss');
         }
         $rss = new SimplePie($this->rss_url, $GLOBALS['codendi_cache_dir'] . '/rss', null, $GLOBALS['sys_proxy']);
         $max_items = 10;
         $items = array_slice($rss->get_items(), 0, $max_items);
         $content .= '<table width="100%">';
         $i = 0;
         foreach ($items as $item) {
             $content .= '<tr class="' . util_get_alt_row_color($i++) . '"><td WIDTH="99%">';
             if ($image = $item->get_link(0, 'image')) {
                 //hack to display twitter avatar
                 $content .= '<img src="' . $hp->purify($image, CODENDI_PURIFIER_CONVERT_HTML) . '" width="48" height="48" style="float:left; margin-right:1em;" />';
             }
             $content .= '<a href="' . $item->get_link() . '">' . $hp->purify($item->get_title(), CODENDI_PURIFIER_STRIP_HTML) . '</a>';
             if ($item->get_date()) {
                 $content .= '<span style="color:#999;" title="' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $item->get_date('U')) . '"> - ' . DateHelper::timeAgoInWords($item->get_date('U')) . '</span>';
             }
             $content .= '</td></tr>';
         }
         $content .= '</table>';
     }
     return $content;
 }
 function display($tpl = null)
 {
     $this->config = JBFactory::getConfig();
     $input = JFactory::getApplication()->input;
     AImporter::model('tour');
     $cart = JModelLegacy::getInstance('TourCart', 'bookpro');
     $cart->load();
     $cart->clear();
     $model = new BookProModelTour();
     $id = $input->getInt('id');
     $this->tour = $model->getComplexItem($id);
     $this->itineraries = TourHelper::buildItinerary($id);
     //$this->packages	= $packages;
     $date = TourHelper::getDateFirstInPackagerateFromTourid($this->tour->id);
     $this->date = JFactory::getDate($date)->format(DateHelper::getConvertDateFormat('P'));
     $this->tour->rdate = $this->date;
     $dispatcher = JDispatcher::getInstance();
     //$this->_prepareDocument();
     //		$dispatcher		= JDispatcher::getInstance();
     //		$this->event 	= new stdClass();
     //		JPluginHelper::importPlugin('bookpro');
     //		$results 		= $dispatcher->trigger('onBookproProductAfterTitle', array ($this->tour));
     //		$this->event->afterDisplayTitle=isset($results[0])?$results[0]:null;
     parent::display($tpl);
 }
 public static function formatTourDate($str, $glue)
 {
     $date = explode(',', $str);
     $result = array();
     for ($i = 0; $i < count($date); $i++) {
         $result[] = DateHelper::formatDate($date[$i]);
     }
     return implode($glue, $result);
 }
 function index($fecha = null)
 {
     if ($fecha == null) {
         $fecha = date("d-m-Y");
     }
     $fecha = DateHelper::dateFormat($fecha, 'd-m-Y Y-m-d');
     $this->set('fecha', $fecha);
     $this->set('datos', $this->Reporte->reporteHorasDia($fecha));
 }
 public function getForm($data = array(), $loadData = true)
 {
     $form = $this->loadForm('com_bookpro.customer', 'customer', array('control' => 'jform', 'load_data' => $loadData));
     $form->setFieldAttribute('birthday', 'format', DateHelper::getConvertDateFormat('M'));
     if (empty($form)) {
         return false;
     }
     return $form;
 }
 public function before_filter()
 {
     $this->filter();
     $this->layout = false;
     $this->current_version = Version::find('first', array('select' => 'versions.*', 'joins' => 'INNER JOIN packages on versions.package_id = packages.id INNER JOIN users ON users.id = packages.user_id', 'order' => 'versions.created_at DESC'));
     $date = DateHelper::from_db($this->current_version->created_at);
     $date = date(DATE_RFC822, $date);
     $this->header("Last-Modified: {$date}");
 }
Exemple #12
0
 public function __get($format)
 {
     if (in_array($format, TimeHelper::$formats)) {
         return TimeHelper::to_string($format, $this->time);
     }
     if (in_array($format, DateHelper::$formats)) {
         return DateHelper::to_string($format, $this->time);
     }
 }
 public function up()
 {
     $table = $this->alter_table('users');
     $table->timestamp('channel_updated');
     $table->go();
     foreach (User::find_all() as $user) {
         $user->channel_updated = DateHelper::to_string('db', time());
         $user->save();
     }
 }
Exemple #14
0
 private function getRemoteRepositoryInfoError()
 {
     $date = DateHelper::timeAgoInWords($this->project_creator_status->getEventDate($this->repository), false, true);
     $url = GIT_BASE_URL . '/?action=repo_management&group_id=' . $this->repository->getProjectId() . '&repo_id=' . $this->repository->getId() . '&pane=gerrit';
     $html = '';
     $html .= '<div class="alert alert-error gerrit_url">';
     $html .= $GLOBALS['Language']->getText('plugin_git', 'delegated_to_gerrit_error', array($date, $url), CODENDI_PURIFIER_DISABLED);
     $html .= '</div>';
     return $html;
 }
 public function ini()
 {
     $date1 = date(NORMALDATEFORMAT);
     $date1test = DateHelper::formatDateFromNormalToDatabase($date1);
     $this->setVars("pureDate1", $date1);
     $this->setVars("formattedDate1", $date1test);
     $date2 = date(DATABASEDATEFORMAT);
     $date2test = DateHelper::formatDateFromDatabaseToNormal($date2);
     $this->setVars("pureDate2", $date2);
     $this->setVars("formattedDate2", $date2test);
     $date3 = date(NORMALDATEFORMAT);
     $date3test = DateHelper::formatDateFromNormalToCustom('d#m#Y', $date3);
     $this->setVars("pureDate3", $date3);
     $this->setVars("formattedDate3", $date3test);
     $date4 = date('d#m#Y');
     $date4test = DateHelper::formatDateFromCustomToNormal('d#m#Y', $date4);
     $this->setVars("pureDate4", $date4);
     $this->setVars("formattedDate4", $date4test);
     $time1 = date(NORMALTIMEFORMAT);
     $time1test = DateHelper::formatTimeFromNormalToDatabase($time1);
     $this->setVars("pureTime1", $time1);
     $this->setVars("formattedTime1", $time1test);
     $time2 = date(DATABASETIMEFORMAT);
     $time2test = DateHelper::formatTimeFromDatabaseToNormal($time2);
     $this->setVars("pureTime2", $time2);
     $this->setVars("formattedTime2", $time2test);
     $time3 = date(NORMALTIMEFORMAT);
     $time3test = DateHelper::formatTimeFromNormalToCustom("H#i#s", $time3);
     $this->setVars("pureTime3", $time3);
     $this->setVars("formattedTime3", $time3test);
     $time4 = date('H#i#s');
     $time4test = DateHelper::formatTimeFromCustomToNormal("H#i#s", $time4);
     $this->setVars("pureTime4", $time4);
     $this->setVars("formattedTime4", $time4test);
     $dateTime1 = date(NORMALDATETIMEFORMAT);
     $dateTime1test = DateHelper::formatDateTimeFromNormalToDatabase($dateTime1);
     $this->setVars("pureDateTime1", $dateTime1);
     $this->setVars("formattedDateTime1", $dateTime1test);
     $dateTime2 = date(DATABASEDATETIMEFORMAT);
     $dateTime2test = DateHelper::formatDateTimeFromDatabaseToNormal($dateTime2);
     $this->setVars("pureDateTime2", $dateTime2);
     $this->setVars("formattedDateTime2", $dateTime2test);
     $dateTime3 = date(NORMALDATETIMEFORMAT);
     $dateTime3test = DateHelper::formatDateTimeFromNormalToCustom("d#m#Y H#i#s", $dateTime3);
     $this->setVars("pureDateTime3", $dateTime3);
     $this->setVars("formattedDateTime3", $dateTime3test);
     $dateTime4 = date('d#m#Y H#i#s');
     $dateTime4test = DateHelper::formatDateTimeFromCustomToNormal("d#m#Y H#i#s", $dateTime4);
     $this->setVars("pureDateTime4", $dateTime4);
     $this->setVars("formattedDateTime4", $dateTime4test);
     $this->view('testDate');
 }
 static function getDayWeek($name)
 {
     AImporter::helper('date');
     $days = DateHelper::dayofweek();
     $daysweek = array();
     foreach ($days as $key => $value) {
         $object = new stdClass();
         $object->key = $key;
         $object->value = $value;
         $daysweek[] = $object;
     }
     $selected = array_keys($days);
     return AHtml::checkBoxList($daysweek, $name, '', $selected, 'key', 'value');
 }
Exemple #17
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id);
     $criteria->compare('t.title', $this->title, true);
     $criteria->compare('t.country_id', $this->country_id);
     $criteria->compare('t.department', $this->department, true);
     $date = DateHelper::toDbDateFormat_tuan($this->posted);
     if (!empty($date)) {
         $criteria->addCondition('DATE(t.posted) = "' . $date . '"');
     }
     $criteria->order = 't.id desc';
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']))));
 }
 protected function saveOrderInfo()
 {
     //save order info
     AImporter::table('orderinfo');
     AImporter::helper('date');
     $this->orderinfo['params']['start'] = DateHelper::createFromFormatYmd($this->orderinfo['params']['start']);
     $this->orderinfo['params']['end'] = DateHelper::createFromFormatYmd($this->orderinfo['params']['end']);
     $orderinfo = $this->orderinfo;
     $orderinfo['order_id'] = $this->table->id;
     $orderinfo['params'] = json_encode($this->orderinfo['params']);
     $orderinfo['start'] = $this->orderinfo['params']['start'];
     $TableOrderinfo = new TableOrderInfo($this->_db);
     return $TableOrderinfo->save($orderinfo);
 }
Exemple #19
0
 public function instantiate($dao)
 {
     // Instantiate a Slim application:
     $app = new \Slim\App(['settings' => ['displayErrorDetails' => true]]);
     // Routes
     $app->get('/api/posts/{id}', function (ServerRequestInterface $request, ResponseInterface $response, $args) use($dao) {
         $params = $request->getQueryParams();
         $id = $args['id'];
         $post = $dao->getPost($id);
         if (!empty($post[0])) {
             $postResponse = ["post" => $post[0]];
         } else {
             // send an empty json list {} and not []
             $postResponse = ["post" => new ArrayObject()];
         }
         $response->getBody()->write(json_encode($postResponse, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE));
         $response = $response->withHeader('Content-type', 'application/json');
         return $response;
     });
     $app->get('/api/posts', function (ServerRequestInterface $request, ResponseInterface $response) use($dao) {
         $params = $request->getQueryParams();
         if (isset($params['author'])) {
             $author = $params['author'];
         } else {
             $author = null;
         }
         // TODO : move in settings
         $formatDate = 'Y-m-d';
         // Date checking
         if (isset($params['from']) || isset($params['to'])) {
             if (!DateHelper::validateDate($formatDate, $params['from']) || !DateHelper::validateDate($formatDate, $params['to'])) {
                 throw new Exception("'from' date parameter or 'to' date parameter is not correct or missing.");
             } else {
                 // pipe concatenation to set h-m-s at 00:00:00
                 $fromDate = DateTime::createFromFormat($formatDate . '|', $params['from']);
                 $toDate = DateTime::createFromFormat($formatDate . '|', $params['to']);
             }
         } else {
             $fromDate = null;
             $toDate = null;
         }
         $post = $dao->getPosts($author, $fromDate, $toDate);
         $postResponse = ["posts" => $post, "count" => count($post)];
         $response->getBody()->write(json_encode($postResponse, JSON_HEX_TAG | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE));
         $response = $response->withHeader('Content-type', 'application/json');
         return $response;
     });
     return $app;
 }
 public function testSpecialFormats()
 {
     Localization::changeLocale('en_US');
     $activeUser = User::isLoggedIn() ? new User() : null;
     if ($activeUser) {
         $activeUser->logout();
     }
     $timestamp = time();
     foreach (array('FILENAME', 'FILE_PROPERTIES', 'FILE_VERSIONS', 'FILE_DOWNLOAD', 'PAGE_VERSIONS', 'DASHBOARD_SEARCH_RESULTS_USERS', 'DASHBOARD_SEARCH_RESULTS_FILES', 'DASHBOARD_SEARCH_RESULTS_PAGES', 'DATE_ATTRIBUTE_TYPE_MDY', 'DATE_ATTRIBUTE_TYPE_T') as $formatName) {
         $this->assertEquals($this->object->date(constant("DATE_APP_{$formatName}"), $timestamp), $this->object->formatSpecial($formatName, $timestamp));
     }
     if ($activeUser) {
         User::getByUserID($activeUser->getUserID(), true);
     }
 }
Exemple #21
0
 static function prettyFormat($date, $format = '{day} {dd} {month} {yyyy}', $empty = 'indéfinie')
 {
     if (!($time = strtotime($date))) {
         return $empty;
     }
     $after = strtotime("+7 day 00:00");
     $afterTomorrow = strtotime("+2 day 00:00");
     $tomorrow = strtotime("+1 day 00:00");
     $today = strtotime("today 00:00");
     $yesterday = strtotime("-1 day 00:00");
     $beforeYesterday = strtotime("-2 day 00:00");
     $before = strtotime("-7 day 00:00");
     if ($time < $after && $time > $before) {
         if ($time >= $after) {
             $relative = strftime("%A", $date) . " prochain";
         } else {
             if ($time >= $afterTomorrow) {
                 $relative = "après demain";
             } else {
                 if ($time >= $tomorrow) {
                     $relative = "demain";
                 } else {
                     if ($time >= $today) {
                         $relative = "aujourd'hui";
                     } else {
                         if ($time >= $yesterday) {
                             $relative = "hier";
                         } else {
                             if ($time >= $beforeYesterday) {
                                 $relative = "avant hier";
                             } else {
                                 if ($time >= $before) {
                                     $relative = strftime("%A", $time) . " dernier";
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (preg_match('/[0-2][0-9]:[0-5][0-9]/', $date)) {
             $relative .= ' à ' . date('H:i', $time);
         }
     } else {
         $relative = 'le ' . DateHelper::format($format);
     }
     return $relative;
 }
 function getContent()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $content = '';
     if ($this->twitterfollow_user) {
         require_once 'common/rss/libs/SimplePie/simplepie.inc';
         if (!is_dir($GLOBALS['codendi_cache_dir'] . '/rss')) {
             mkdir($GLOBALS['codendi_cache_dir'] . '/rss');
         }
         $twitterfollow = new SimplePie($this->getFeedUrl($this->twitterfollow_user), $GLOBALS['codendi_cache_dir'] . '/rss', null, $GLOBALS['sys_proxy']);
         $max_items = 10;
         $items = array_slice($twitterfollow->get_items(), 0, $max_items);
         $content .= '<table width="100%">';
         $i = 0;
         foreach ($items as $i => $item) {
             $content .= '<tr class="' . util_get_alt_row_color($i++) . '"><td WIDTH="99%">';
             $content .= '<div style="float:right;">';
             $content .= '<a title="Reply" href="' . $this->getReplyToUrl($this->twitterfollow_user, basename($item->get_link())) . '">';
             $content .= $GLOBALS['HTML']->getImage('ic/twitter_reply.gif');
             $content .= '</a>';
             $content .= '</div>';
             $content .= '<span';
             if ($i == 1) {
                 $content .= ' style="font-size:1.5em">';
                 if ($image = $item->get_link(0, 'image')) {
                     //hack to display twitter avatar
                     $image = preg_replace('/_normal\\.(jpg|png|gif)$/i', '_bigger.$1', $image);
                     $content .= '<a href="http://twitter.com/' . urlencode($this->twitterfollow_user) . '">';
                     $content .= '<img src="' . $hp->purify($image, CODENDI_PURIFIER_CONVERT_HTML) . '" width="48" height="48" style="float:left; margin-right:1em;" />';
                     $content .= '</a>';
                 }
             } else {
                 $content .= '>';
                 //end of <span
             }
             $content .= $item->get_title();
             //Trust SimplePie for purifying
             if ($item->get_date()) {
                 $content .= ' <span style="color:#999; white-space:nowrap;" title="' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $item->get_date('U')) . '">- ' . DateHelper::timeAgoInWords($item->get_date('U')) . '</span>';
             }
             $content .= '</span>';
             $content .= '</td></tr>';
         }
         $content .= '</table>';
     }
     return $content;
 }
Exemple #23
0
 /**
  *   Метод выводит форму редактирования существующего аккаунта
  * @return
  */
 public function showAdminUpdate($id)
 {
     try {
         $oAccount = $this->getUser($id);
         // Готовим данные для вывода
         $szTitle = 'Просмотр и редактирование профиля "' . htmlspecialchars($oAccount->login) . '"';
         $aBegin = array('Пользователи' => 'index.php', $szTitle => '#');
         $tabSheets = array(array('id' => 'tab_main', 'title' => 'Авторизация'), array('id' => 'tab_additional', 'title' => 'Доп. данные'));
         // Начало вывода
         $design = \CMSDesign::getInstance();
         $this->outputHeader($aBegin, $szTitle);
         $design->formBegin();
         $design->submit('submit', 'Сохранить');
         $design->tabs->sheetsBegin($tabSheets);
         $design->tabs->contentBegin($tabSheets[0]['id']);
         $design->tableBegin();
         // Обязательные поля
         $design->row2cell('Логин пользователя', $oAccount->login->getAdminFormValue());
         $design->row2cell('Зарегистрирован', $oAccount->registered->getCyrilicViewValue());
         $design->row2cell('Последняя активность', \DateHelper::getCyrilicViewValue($oAccount->last_activity_date->getValue()));
         $design->row2cell('Пароль', $oAccount->password->getAdminFormValue());
         $design->row2cell('Код подтверждения авторизации', $oAccount->confirmation_code->getAdminFormValue());
         $design->row2cell('E-mail', $oAccount->email->getAdminFormValue());
         $design->row2cell('Права пользователя', $oAccount->rights->getAdminFormValue());
         $design->row2cell('Время доступа', $oAccount->time_access->getAdminFormValue());
         $design->tableEnd();
         $design->tabs->contentEnd();
         $design->tabs->contentBegin($tabSheets[1]['id']);
         $design->tableBegin();
         \EventController::callEvent('users_admin_update_form', $oAccount, $design);
         $design->tableEnd();
         $design->tabs->contentEnd();
         $design->tabs->sheetsEnd();
         // Завершаем вывод
         $design->hidden('id', $oAccount->id->getValue());
         $design->hidden('typeName', UserAccount::ModelName);
         $design->submit('submit', 'Сохранить');
         $design->formEnd();
         $design->documentEnd();
         $design->end();
         $this->output();
     } catch (\Exception $e) {
         $this->addError('Профайл не был найден');
         $this->jumpBack();
     }
 }
Exemple #24
0
 /**
 Получить список новостей
 */
 private function getNews()
 {
     $news = News::model()->onSite()->onMain()->orderDefault()->byLimit(4)->findAll();
     return $news;
     $arr = array();
     $news = News::model()->onSite()->onMain()->byLimit(self::LIMIT)->findAll();
     foreach ($news as &$n) {
         $size = 140;
         $text = strip_tags($n->title);
         if (mb_strlen($text, 'utf-8') > $size) {
             $lastSpacePos = mb_strrpos(mb_substr($text, 0, $size, 'utf-8'), ' ', 'utf-8');
             $text = mb_substr($text, 0, $lastSpacePos, 'utf-8') . "…";
         }
         $arr[] = array('id' => $n->id, 'date' => DateHelper::formatNewsDate($n->createTime), 'text' => $text, 'image' => $n->getImageUrl(), 'link' => CHtml::normalizeUrl(array('/news/news/show', 'id' => $n->id)));
     }
     return $arr;
 }
Exemple #25
0
 function postSaveHook($model, $validData)
 {
     //save orderinfo
     if ($validData['id']) {
         AImporter::helper('date');
         AImporter::table('orderinfo');
         $orderinfo = $this->input->get('orderinfo', array(), 'array');
         $orderinfo['params']['start'] = DateHelper::createFromFormatYmd($orderinfo['params']['start']);
         $orderinfo['params']['end'] = DateHelper::createFromFormatYmd($orderinfo['params']['end']);
         $orderinfo['start'] = $orderinfo['params']['start'];
         $orderinfo['params'] = json_encode($orderinfo['params']);
         // 			debug($orderinfo);die;
         $db = JFactory::getDbo();
         $table = new TableOrderInfo($db);
         $table->load(array('order_id' => $validData['id']));
         return $table->save($orderinfo);
     }
     return true;
 }
Exemple #26
0
 /**
  * Remind approval table approvers
  *
  * @return Void
  */
 public function remindApprovers()
 {
     $dao = new Docman_ApprovalTableItemDao();
     $dar = $dao->getTablesForReminder();
     $tables = array();
     if ($dar && !$dar->isError()) {
         foreach ($dar as $row) {
             if ($row['item_id']) {
                 $table = new Docman_ApprovalTableItem();
             } else {
                 $table = new Docman_ApprovalTableFile();
             }
             $table->initFromRow($row);
             $distance = DateHelper::dateDiffInDays($table->getDate(), $_SERVER['REQUEST_TIME']);
             if ($distance > 0 && DateHelper::isPeriodicallyDistant($distance, $table->getNotificationOccurence())) {
                 $this->sendNotificationToPendingApprovers($table);
             }
         }
     }
 }
 function graficoActividad($id_usuario = null, $id_actividad, $ini, $fin)
 {
     $actividad = $this->Actividad->find('list', array('conditions' => "Actividad.id_actividad={$id_actividad}"));
     $tit = "Promedio de " . current($actividad) . " entre {$ini} y {$fin}";
     $ini = DateHelper::dateFormat($ini, 'd-m-Y Y-m-d');
     $fin = DateHelper::dateFormat($fin, 'd-m-Y Y-m-d');
     $dataUsuario = $this->Reporte->promedioActividadesPorDia($id_usuario, $id_actividad, $ini, $fin);
     $dataPromedio = $this->Reporte->promedioActividadesPorDia(null, $id_actividad, $ini, $fin);
     #Grafica
     $this->Jpgraph->newGraph(700, 300);
     $dataY = $this->dataGrafico($dataPromedio, 'promedio');
     //if(count($dataY)<=0) exit;
     $this->Jpgraph->Line($dataY, 'Promedio por Hora', 'red');
     #Trabajador
     $dataY = $this->dataGrafico($dataUsuario, 'promedio', $dataPromedio);
     $this->Jpgraph->Line($dataY, 'Producción/hora', 'navy', 3);
     $dataX = $this->dataGrafico($dataPromedio, 'fecha');
     if (count($dataPromedio) > 0) {
         $this->Jpgraph->present($dataX, $tit);
     }
 }
 public static function saveUserLoginHistory()
 {
     $db = \Cobalt\Container::fetch('db');
     $query = $db->getQuery(true);
     $user_id = UsersHelper::getUserId();
     $today = DateHelper::formatDBDate(date("Y-m-d"));
     $query->clear();
     $query->select("COUNT(id)");
     $query->from("#__login_history");
     $query->where("date='" . $today . "'");
     $query->where("user_id=" . $user_id);
     $db->setQuery($query);
     $existing = $db->loadResult();
     if (!$existing) {
         $query->clear();
         $query->insert("#__login_history");
         $query->set("user_id=" . $user_id . ",date='" . $today . "'");
         $db->setQuery($query);
         $db->query();
     }
 }
 /**
  * index
  */
 public function index()
 {
     switch ($this->format) {
         case 'xml':
             if ($this->user->active == 0) {
                 exit;
             }
             $this->layout = false;
             $this->render('channel/index.xml');
             $this->header('Content-Type: text/xml', 200);
             $this->current_version = Version::find('first', array('select' => 'versions.*', 'joins' => 'INNER JOIN packages on versions.package_id = packages.id INNER JOIN users ON users.id = packages.user_id', 'order' => 'versions.version DESC'));
             $date = DateHelper::from_db($this->current_version->created_at);
             $date = date(DATE_RFC822, $date);
             $this->header("Last-Modified: {$date}");
             break;
         default:
             $this->packages = $this->user->packages;
             $this->header('Content-Type: text/html', 200);
             break;
     }
 }
Exemple #30
0
 public function search()
 {
     AImporter::helper('date');
     AImporter::model('tours');
     $transport_cart = $this->getCart('TransportCart');
     $transport_cart->tour = 1;
     $transport_cart->saveToSession();
     $app = JFactory::getApplication();
     $this->cart = $this->getCart();
     $this->cart->filter = array();
     $this->cart->filter['adult'] = $app->input->getInt('adult');
     $this->cart->filter['child'] = $app->input->getInt('child');
     $this->cart->filter['infant'] = $app->input->getInt('infant');
     $this->cart->filter['cat_id'] = $app->input->getInt('cat_id');
     $this->cart->filter['start'] = DateHelper::createFromFormatYmd($app->input->getString('start'));
     $this->cart->saveToSession();
     $tours = $this->getTour();
     //		debug($tours);die;
     $view = $this->getView('tours', 'html', 'BookProView');
     $view->assign('cart', $this->cart);
     $view->assign('tours', $tours);
     $view->display();
     return;
 }