当前位置: 首页>>代码示例>>PHP>>正文


PHP FD::date方法代码示例

本文整理汇总了PHP中FD::date方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::date方法的具体用法?PHP FD::date怎么用?PHP FD::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FD的用法示例。


在下文中一共展示了FD::date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 public function main()
 {
     // Loop through 200 users at one time
     $limit = 200;
     // Set all points status to 0 first.
     $db = FD::db();
     $sql = $db->sql();
     $sql->update('#__social_points_history');
     $sql->set('state', 0);
     $db->setQuery($sql);
     $db->Query();
     // Now we need to merge all of these records into 1
     $sql->clear();
     // We need to use Joomla's date instead of mysql's NOW() because the timezone on mysql could be different.
     $date = FD::date();
     $query = array();
     $query[] = 'INSERT INTO `#__social_points_history`(`points_id`,`user_id`,`points`,`created`,`state`,`message`)';
     $query[] = "SELECT 0, `user_id` ,SUM(`points`), '" . $date->toSql() . "', 1, 'COM_EASYSOCIAL_POINTS_AGGREGATED' FROM `#__social_points_history` GROUP BY `user_id`";
     $query = implode(' ', $query);
     $sql->raw($query);
     $db->setQuery($sql);
     $db->Query();
     // Then we need to delete all the unpublished records
     $sql->clear();
     $sql->delete('#__social_points_history');
     $sql->where('state', 0);
     $db->setQuery($sql);
     $db->Query();
     // Also delete any points history that is assigned to guests
     $sql->clear();
     $sql->delete('#__social_points_history');
     $sql->where('user_id', 0);
     $db->setQuery($sql);
     $db->Query();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:MergeUsersPointsHistory.php

示例2: sidebarBottom

 public function sidebarBottom($groupId)
 {
     $params = $this->getParams();
     if (!$params->get('widget', true)) {
         return;
     }
     $group = FD::group($groupId);
     if (!$group->getAccess()->get('events.groupevent', true)) {
         return;
     }
     $my = FD::user();
     $days = $params->get('widget_days', 14);
     $total = $params->get('widget_total', 5);
     $date = FD::date();
     $now = $date->toSql();
     $future = FD::date($date->toUnix() + $days * 24 * 60 * 60)->toSql();
     $options = array();
     $options['start-after'] = $now;
     $options['start-before'] = $future;
     $options['limit'] = $total;
     $options['state'] = SOCIAL_STATE_PUBLISHED;
     $options['ordering'] = 'start';
     $options['group_id'] = $groupId;
     $events = FD::model('Events')->getEvents($options);
     if (empty($events)) {
         return;
     }
     $theme = FD::themes();
     $theme->set('events', $events);
     $theme->set('app', $this->app);
     echo $theme->output('themes:/apps/user/events/widgets/dashboard/upcoming');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:32,代码来源:view.html.php

示例3: post

 /**
  * Restful api to submit a new comment on the site
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function post()
 {
     // Get the user's id by validation
     $userId = $this->validateAuth();
     $uid = $this->input->get('uid', 0, 'int');
     $element = $this->input->get('element', '', 'string');
     $verb = $this->input->get('verb', '', 'cmd');
     $group = $this->input->get('group', '', 'cmd');
     $streamId = $this->input->get('stream_id', 0, 'int');
     // Determines the comments parent
     $parent = $this->input->get('parent', 0, 'int');
     // Comment data
     $content = $this->input->get('content', '', 'default');
     // Content cannot be empty
     if (empty($content)) {
         $this->set('code', 403);
         $this->set('message', JText::_('Please enter some contents for the comment.'));
         return parent::display();
     }
     // Format the element
     $element = $element . '.' . $group . '.' . $verb;
     // Get the table object
     $table = FD::table('Comments');
     $table->element = $element;
     $table->uid = $uid;
     $table->comment = $content;
     $table->created_by = $userId;
     $table->created = FD::date()->toSql();
     $table->parent = $parent;
     $table->stream_id = $streamId;
     $state = $table->store();
     $this->set('status', 1);
     parent::display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:42,代码来源:view.json.php

示例4: onDisplay

 public function onDisplay($user)
 {
     $regDate = FD::date($user->registerDate);
     $format = 'd M Y';
     switch ($this->params->get('date_format')) {
         case 2:
         case '2':
             $format = 'M d Y';
             break;
         case 3:
         case '3':
             $format = 'Y d M';
             break;
         case 4:
         case '4':
             $format = 'Y M d';
             break;
     }
     // linkage to advanced search page.
     // place the code here so that the timezone wont kick in. we search the date using GMT value.
     $field = $this->field;
     if ($field->searchable) {
         $date = $regDate->toFormat('Y-m-d');
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'between';
         $params['conditions[]'] = $date . ' 00:00:00' . '|' . $date . ' 23:59:59';
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     $this->set('date', $regDate->toFormat($format));
     return $this->display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:joomla_joindate.php

示例5: broadcast

 /**
  * Broadcast a message to a set of profiles on the site.
  *
  * @since	1.3
  * @access	public
  * @param 	int 	The profile id to target. 0 for all
  * @param	string  The message to be broadcasted
  * @param 	string  The title for the announcement
  * @return
  */
 public function broadcast($id, $content, $createdBy, $title = '', $link = '')
 {
     $db = FD::db();
     $sql = $db->sql();
     $query = array();
     $query[] = 'INSERT INTO ' . $db->quoteName('#__social_broadcasts');
     $query[] = '(`target_id`,`target_type`,`title`,`content`,`link`,`state`,`created`,`created_by`)';
     // Get the creation date
     $date = FD::date();
     $query[] = 'SELECT';
     $query[] = '`user_id`,' . $db->Quote(SOCIAL_TYPE_USER) . ',' . $db->Quote($title) . ',' . $db->Quote($content) . ',' . $db->Quote($link) . ',1,' . $db->Quote($date->toSql()) . ',' . $db->Quote($createdBy);
     $query[] = 'FROM ' . $db->quoteName('#__social_profiles_maps');
     $query[] = 'WHERE 1';
     if (!empty($id)) {
         $query[] = 'AND ' . $db->quoteName('profile_id') . '=' . $db->Quote($id);
     }
     // Exclude the broadcaster because it would be pretty insane if I am spamming myself
     $my = FD::user();
     $query[] = 'AND `user_id` !=' . $db->Quote($my->id);
     $query = implode(' ', $query);
     $sql->raw($query);
     $db->setQuery($sql);
     $state = $db->Query();
     if (!$state) {
         return $state;
     }
     // Get the id of the new broadcasted item
     $id = $db->insertid();
     return $id;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:40,代码来源:broadcast.php

示例6: install

 /**
  * Given a path to the file, install the points.
  *
  * @since	1.0
  * @access	public
  * @param	string		The path to the .points file.
  * @return	bool		True if success false otherwise.
  */
 public function install($file)
 {
     // Import platform's file library.
     jimport('joomla.filesystem.file');
     // Convert the contents to an object
     $alerts = FD::makeObject($file);
     $result = array();
     if ($alerts) {
         foreach ($alerts as $alert) {
             $table = FD::table('Alert');
             $exists = $table->load(array('element' => $alert->element, 'rule' => $alert->rule));
             if (!$exists) {
                 $table->element = $alert->element;
                 $table->rule = $alert->rule;
                 $table->created = FD::date()->toSql();
                 if (!isset($alert->value)) {
                     $table->email = true;
                     $table->system = true;
                 } else {
                     $table->email = $alert->value->email;
                     $table->system = $alert->value->system;
                 }
             }
             $table->app = isset($alert->app) ? $alert->app : false;
             $table->field = isset($alert->field) ? $alert->field : false;
             $table->group = isset($alert->group) ? $alert->group : false;
             $table->extension = isset($alert->extension) ? $alert->extension : false;
             $table->core = isset($alert->core) ? $alert->core : 0;
             $table->app = isset($alert->app) ? $alert->app : 0;
             $table->field = isset($alert->field) ? $alert->field : 0;
             $result[] = $table->store();
         }
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:43,代码来源:alert.php

示例7: getEndDate

 public function getEndDate()
 {
     static $dates = array();
     if (!isset($dates[$this->id])) {
         $dates[$this->id] = FD::date($this->date_end);
     }
     return $dates[$this->id];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:8,代码来源:calendar.php

示例8: store

 /**
  * Stores the relationship data.
  *
  * @author Jason Rey <jasonrey@stackideas.com>
  * @since  1.0
  * @access public
  * @param  boolean   $updateNulls True to update fields even if they are null.
  * @return boolean                True on success.
  */
 public function store($updateNulls = false)
 {
     $db = FD::db();
     if (is_null($this->created)) {
         $this->created = FD::date()->toSql();
     }
     return parent::store($updateNulls);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:17,代码来源:relations.php

示例9: post

 public function post()
 {
     $app = JFactory::getApplication();
     $element = $app->input->get('element', '', 'string');
     $group = $app->input->get('group', '', 'string');
     $verb = $app->input->get('verb', '', 'string');
     $uid = $app->input->get('uid', 0, 'int');
     //element id
     $input = $app->input->get('comment', "", 'RAW');
     $params = $app->input->get('params', array(), 'ARRAY');
     //params
     $streamid = $app->input->get('stream_id', '', 'INT');
     //whole stream id
     $parent = $app->input->get('parent', 0, 'INT');
     //parent comment id
     $result = new stdClass();
     $valid = 1;
     if (!$uid) {
         $result->id = 0;
         $result->status = 0;
         $result->message = 'Empty element id not allowed';
         $valid = 0;
     }
     // Message should not be empty.
     if (!$streamid) {
         $result->id = 0;
         $result->status = 0;
         $result->message = 'Empty stream id not allowed';
         $valid = 0;
     } else {
         if ($valid) {
             // Normalize CRLF (\r\n) to just LF (\n)
             $input = str_ireplace("\r\n", "\n", $input);
             $compositeElement = $element . '.' . $group . '.' . $verb;
             $table = FD::table('comments');
             $table->element = $compositeElement;
             $table->uid = $uid;
             $table->comment = $input;
             $table->created_by = FD::user()->id;
             $table->created = FD::date()->toSQL();
             $table->parent = $parent;
             $table->params = $params;
             $table->stream_id = $streamid;
             $state = $table->store();
             if ($state) {
                 //create result obj
                 $result->status = 1;
                 $result->message = 'comment saved successfully';
             } else {
                 //create result obj
                 $result->status = 0;
                 $result->message = 'Unable to save comment';
             }
         }
     }
     $this->plugin->setResponse($result);
 }
开发者ID:beingsane,项目名称:com_api-plugins,代码行数:57,代码来源:comments.php

示例10: send

 /**
  * Sends a new share to a user.
  *
  * @since	1.0
  * @access	public
  */
 public function send()
 {
     FD::checkToken();
     $token = JRequest::getString('token', '');
     $recipients = JRequest::getVar('recipients', array());
     $content = JRequest::getVar('content', '');
     // Get the current view.
     $view = $this->getCurrentView();
     // Cleaning
     if (is_string($recipients)) {
         $recipients = explode(',', FD::string()->escape($recipients));
     }
     if (is_array($recipients)) {
         foreach ($recipients as &$recipient) {
             $recipient = FD::string()->escape($recipient);
             if (!JMailHelper::isEmailAddress($recipient)) {
                 return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_RECIPIENT'));
             }
         }
     }
     $content = FD::string()->escape($content);
     // Check for valid data
     if (empty($recipients)) {
         return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_NO_RECIPIENTS'));
     }
     if (empty($token)) {
         return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_TOKEN'));
     }
     $session = JFactory::getSession();
     $config = FD::config();
     $limit = $config->get('sharing.email.limit', 0);
     $now = FD::date()->toUnix();
     $time = $session->get('easysocial.sharing.email.time');
     $count = $session->get('easysocial.sharing.email.count');
     if (is_null($time)) {
         $session->set('easysocial.sharing.email.time', $now);
         $time = $now;
     }
     if (is_null($count)) {
         $session->set('easysocial.sharing.email.count', 0);
     }
     $diff = $now - $time;
     if ($diff <= 3600) {
         if ($limit > 0 && $count >= $limit) {
             return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_SHARING_LIMIT_MAXED'));
         }
         $count++;
         $session->set('easysocial.sharing.email.count', $count);
     } else {
         $session->set('easysocial.sharing.email.time', $now);
         $session->set('easysocial.sharing.email.count', 1);
     }
     $library = FD::get('Sharing');
     $library->sendLink($recipients, $token, $content);
     $view->call(__FUNCTION__, true);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:62,代码来源:sharing.php

示例11: onRegisterOAuthBeforeSave

 public function onRegisterOAuthBeforeSave(&$post, $client)
 {
     if (empty($post['birthday'])) {
         return;
     }
     // Facebook format is M/D/Y, we reformat it to Y-M-D
     $date = explode('/', $post['birthday']);
     $reformedDate = FD::date($date[2] . '-' . $date[0] . '-' . $date[1]);
     $post[$this->inputName] = array('date' => $reformedDate->toSql());
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:10,代码来源:birthday.php

示例12: clearExpired

 /**
  * Purges the URL cache from the site
  *
  * @since	1.0
  * @access	public
  * @param	int		The number of days interval
  * @return	bool	True on success, false otherwise.
  */
 public function clearExpired($interval)
 {
     $db = FD::db();
     $sql = $db->sql();
     $date = FD::date();
     $query = 'DELETE FROM `#__social_links` WHERE DATE_ADD( `created` , INTERVAL ' . $interval . ' DAY) <= ' . $db->Quote($date->toMySQL());
     $sql->raw($query);
     $db->setQuery($sql);
     return $db->Query();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:18,代码来源:links.php

示例13: date

 /**
  * Formats a given date string with a given date format
  *
  * @since	1.0
  * @access	public
  * @param	string		The current timestamp
  * @param	string		The language string format or the format for Date
  * @param	bool		Determine if it should be using the appropriate offset or GMT
  * @return
  */
 public static function date($timestamp, $format = '', $withOffset = true)
 {
     // Get the current date object based on the timestamp provided.
     $date = FD::date($timestamp, $withOffset);
     // If format is not provided, we should use DATE_FORMAT_LC2 by default.
     $format = empty($format) ? 'DATE_FORMAT_LC2' : $format;
     // Get the proper format.
     $format = JText::_($format);
     $dateString = $date->toFormat($format);
     return $date->toFormat($format);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:21,代码来源:string.php

示例14: generateToken

 /**
  * Generates a unique token for the current session.
  * Without this token, the caller isn't allowed to upload the file.
  *
  * @since	1.0
  * @param	null
  * @return	string		A 12 digit token that can only be used once.
  */
 public function generateToken()
 {
     // Generate a unique id.
     $id = uniqid();
     // Add md5 hash
     $id = md5($id);
     $table = FD::table('UploaderToken');
     $table->token = $id;
     $table->created = FD::date()->toMySQL();
     $table->store();
     return $id;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:20,代码来源:uploader.php

示例15: sidebarBottom

 /**
  * Displays the dashboard widget
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function sidebarBottom()
 {
     // Get the app params
     $params = $this->app->getParams();
     $key = $params->get('dashboard_show_uniquekey', 'BIRTHDAY');
     $displayYear = $params->get('dashboard_show_birthday', 1);
     // Get current logged in user
     $my = FD::user();
     $birthdays = $this->getUpcomingBirthdays($key, $my->id);
     $ids = array();
     $dateToday = FD::date()->toFormat('md');
     $today = array();
     $otherDays = array();
     // Hide app when there's no upcoming birthdays
     if (!$birthdays) {
         return;
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     if ($birthdays) {
         foreach ($birthdays as $birthday) {
             $ids[] = $birthday->uid;
         }
         // Preload list of users
         FD::user($ids);
         foreach ($birthdays as $birthday) {
             $obj = new stdClass();
             $obj->user = FD::user($birthday->uid);
             $obj->birthday = $birthday->displayday;
             //Checking to display year here
             if ($displayYear) {
                 $dateFormat = JText::_('COM_EASYSOCIAL_DATE_DMY');
                 //check birtday the year privacy
                 if (!$privacy->validate('field.birthday', $birthday->field_id, 'year', $birthday->uid)) {
                     $dateFormat = JText::_('COM_EASYSOCIAL_DATE_DM');
                 }
             } else {
                 $dateFormat = JText::_('COM_EASYSOCIAL_DATE_DM');
             }
             $obj->display = FD::date($obj->birthday)->format($dateFormat);
             if ($birthday->day == $dateToday) {
                 $today[] = $obj;
             } else {
                 $otherDays[] = $obj;
             }
         }
     }
     $this->set('ids', $ids);
     $this->set('birthdays', $birthdays);
     $this->set('today', $today);
     $this->set('otherDays', $otherDays);
     echo parent::display('widgets/upcoming.birthday');
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:61,代码来源:view.html.php


注:本文中的FD::date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。