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


PHP DateUtil::formatDate方法代码示例

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


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

示例1: execute

 /**
  * @see TemplatePluginModifier::execute()
  */
 public function execute($tagArgs, Template $tplObj)
 {
     if (isset($tagArgs[2])) {
         $useStrftime = $tagArgs[2] ? true : false;
     } else {
         $useStrftime = isset($tagArgs[1]) ? true : false;
     }
     return DateUtil::formatDate(isset($tagArgs[1]) ? $tagArgs[1] : null, $tagArgs[0], false, $useStrftime);
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:12,代码来源:TemplatePluginModifierDate.class.php

示例2: __construct

 /**
  * Constructs an instance of this class.
  */
 public function __construct()
 {
     // get current server system time for use with date() in order to ensure valid
     // and consistent date and time values all over one instance of this class
     // in case the timebase is "now" which will be the case if no multipleExec action
     // is requested by configuration.
     $this->now = TIME_NOW;
     // set the timezone which is either the one set by the WBB admin, or if it isn't set, it's GMT.
     DateUtil::formatDate();
     // set cache name.
     $this->cacheName = 'cronjobs-' . PACKAGE_ID;
     // read cache.
     $this->getCronjobsCache();
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:17,代码来源:CronjobsExec.class.php

示例3: readData

 /**
  * @see Page::readData()
  */
 public function readData()
 {
     $newsletter = new NewsletterEditor($this->newsletterID);
     $this->subject = $newsletter->subject;
     $this->text = $newsletter->text;
     $time = $newsletter->deliveryTime;
     $dateArray = explode('-', DateUtil::formatDate('%Y-%m-%d' . (MESSAGE_NEWSLETTERSYSTEM_GENERAL_HOURLYCRONJOB ? '-%H' : ''), $time, false, true));
     $this->dateValues['day'] = $dateArray[2];
     $this->dateValues['month'] = $dateArray[1];
     $this->dateValues['year'] = $dateArray[0];
     if (MESSAGE_NEWSLETTERSYSTEM_GENERAL_HOURLYCRONJOB) {
         $this->dateValues['hour'] = $dateArray[3];
     }
     parent::readData();
 }
开发者ID:CaribeSoy,项目名称:Newsletter-System,代码行数:18,代码来源:NewsletterEditForm.class.php

示例4: getFormElement

 /**
  * @see OptionType::getFormElement()
  */
 public function getFormElement(&$optionData)
 {
     if (!isset($optionData['optionValue'])) {
         if (isset($optionData['defaultValue'])) {
             $optionData['optionValue'] = $optionData['defaultValue'];
         } else {
             $optionData['optionValue'] = '';
         }
     }
     $optionData['isOptionGroup'] = true;
     $optionData['divClass'] = 'formDate';
     $year = $month = $day = '';
     $optionValue = explode('-', is_array($optionData['optionValue']) ? implode('-', $optionData['optionValue']) : $optionData['optionValue']);
     if (isset($optionValue[0])) {
         $year = intval($optionValue[0]);
     }
     if (empty($year)) {
         $year = '';
     }
     if (isset($optionValue[1])) {
         $month = $optionValue[1];
     }
     if (isset($optionValue[2])) {
         $day = $optionValue[2];
     }
     $dateInputOrder = explode('-', WCF::getLanguage()->get('wcf.global.dateInputOrder'));
     // generate days
     $days = array();
     $days[0] = '';
     for ($i = 1; $i < 32; $i++) {
         $days[$i] = $i;
     }
     // generate months
     $months = array();
     $months[0] = '';
     $monthFormat = Language::$dateFormatLocalized ? '%B' : '%m';
     for ($i = 1; $i < 13; $i++) {
         $months[$i] = DateUtil::formatDate($monthFormat, gmmktime(0, 0, 0, $i, 10, 2006), false, true);
     }
     WCF::getTPL()->assign(array('year' => $year, 'month' => $month, 'day' => $day, 'days' => $days, 'months' => $months, 'optionData' => $optionData, 'dateInputOrder' => $dateInputOrder, 'yearRequired' => $this->yearRequired));
     return WCF::getTPL()->fetch('optionTypeDate');
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:45,代码来源:OptionTypeDate.class.php

示例5: __construct

 /**
  * Creates a new MessageSidebar object.
  *
  * @param	UserProfile	$user
  */
 public function __construct(MessageSidebarObject $object)
 {
     $this->object = $object;
     // init user options
     if ($this->getUser()->userID) {
         if (!$this->getUser()->protectedProfile || $this->getUser()->userID == WCF::getUser()->userID) {
             $userOptions = self::getUserOptions();
             $categories = $userOptions->getOptionTree('profile', $this->getUser());
             // add registration date
             if (MESSAGE_SIDEBAR_ENABLE_REGISTRATION_DATE == 1) {
                 $this->addUserCredit(WCF::getLanguage()->get('wcf.user.registrationDate'), DateUtil::formatDate(null, $this->getUser()->registrationDate));
             }
             // user options
             foreach ($categories as $category) {
                 if ($category['categoryName'] == 'profile.contact' || $category['categoryName'] == 'profile.messenger') {
                     foreach ($category['options'] as $userOption) {
                         $this->addUserContact($userOption['optionValue']);
                     }
                 } else {
                     foreach ($category['options'] as $userOption) {
                         if ($userOption['optionName'] == 'birthday' || $userOption['optionName'] == 'gender') {
                             $this->addUserSymbol($userOption['optionValue']);
                         } else {
                             $this->addUserCredit(WCF::getLanguage()->get('wcf.user.option.' . $userOption['optionName']), $userOption['optionValue']);
                         }
                     }
                 }
             }
             // add friend icon
             if (MESSAGE_SIDEBAR_ENABLE_FRIEND_ICON) {
                 if (WCF::getUser()->userID && UserProfile::isBuddy($this->getUser()->userID)) {
                     $this->addUserSymbol('<img src="' . StyleManager::getStyle()->getIconPath('friendsS.png') . '" alt="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.friend', array('username' => $this->getUser()->username)) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.friend', array('username' => $this->getUser()->username)) . '" />');
                 }
             }
         }
         // banned icon
         if ($object->getUser()->banned) {
             $this->addUserSymbol('<img src="' . StyleManager::getStyle()->getIconPath('bannedS.png') . '" alt="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.banned', array('username' => $this->getUser()->username)) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.banned', array('username' => $this->getUser()->username)) . '" />');
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:46,代码来源:MessageSidebar.class.php

示例6: assignVariables

 /**
  * @see Page::assignVariables()
  */
 public static function assignVariables()
 {
     // create calendar data
     $dayOptions = array(0 => '');
     $hourOptions = $minuteOptions = array('' => '');
     $monthList = $weekdayList = '';
     $weekdays = $monthOptions = array();
     // days
     for ($i = 1; $i <= 31; $i++) {
         $dayOptions[$i] = $i;
     }
     // months
     $monthFormat = Language::$dateFormatLocalized ? '%B' : '%m';
     for ($i = 1; $i <= 12; $i++) {
         $monthOptions[$i] = DateUtil::formatDate($monthFormat, gmmktime(0, 0, 0, $i, 15, 2000), false, true);
     }
     $monthList = implode(',', $monthOptions);
     $monthOptions[0] = '';
     ksort($monthOptions);
     // weekdays
     for ($i = 1; $i <= 7; $i++) {
         $weekdayNumber = intval(DateUtil::formatDate('%w', gmmktime(0, 0, 0, 1, $i, 2000), false, true));
         $weekdays[$weekdayNumber] = DateUtil::formatDate('%a', gmmktime(0, 0, 0, 1, $i, 2000), false, true);
     }
     ksort($weekdays);
     $weekdayList = implode(',', $weekdays);
     // hours
     for ($i = 0; $i < 24; $i++) {
         $hourOptions[$i] = $i < 10 ? "0" . $i : $i;
     }
     // minutes
     for ($i = 0; $i < 60; $i += 5) {
         $minuteOptions[$i] = $i < 10 ? "0" . $i : $i;
     }
     WCF::getTPL()->assign(array('monthOptions' => $monthOptions, 'monthList' => $monthList, 'dayOptions' => $dayOptions, 'weekdayList' => $weekdayList, 'startOfWeek' => WCF::getUser()->firstDayOfWeek == '' ? 1 : intval(WCF::getUser()->firstDayOfWeek), 'hourOptions' => $hourOptions, 'minuteOptions' => $minuteOptions));
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:39,代码来源:InlineCalendar.class.php

示例7: getAge

 /**
  * Returns the age of this user.
  *
  * @return	integer
  */
 public function getAge()
 {
     if ($this->birthday) {
         // split date
         $year = $month = $day = 0;
         $optionValue = explode('-', $this->birthday);
         if (isset($optionValue[0])) {
             $year = intval($optionValue[0]);
         }
         if (isset($optionValue[1])) {
             $month = intval($optionValue[1]);
         }
         if (isset($optionValue[2])) {
             $day = intval($optionValue[2]);
         }
         // calc
         if ($year) {
             $age = DateUtil::formatDate('%Y', null, false, true) - $year;
             if (intval(DateUtil::formatDate('%m', null, false, true)) < intval($month)) {
                 $age--;
             } else {
                 if (intval(DateUtil::formatDate('%m', null, false, true)) == intval($month) && DateUtil::formatDate('%e', null, false, true) < intval($day)) {
                     $age--;
                 }
             }
             return $age;
         }
     }
     return 0;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:35,代码来源:UserProfile.class.php

示例8: create

    /**
     * Reads the data that should be displayed in the report and creates it.
     */
    protected function create()
    {
        $this->blocks = $this->getDisplayBlocks();
        Spec::storeData($this->getTargetPlanet(), $this->getOfiara());
        // header
        $this->ereport .= '<table>
	    			<tr>
		    			<td class="c" colspan="4">';
        // TODO: fix
        if (!defined('TIMEZONE')) {
            define('TIMEZONE', '1');
        }
        WCF::getUser()->timezone = TIMEZONE;
        echo "utz:" . WCF::getUser()->timezone . "gtz:" . TIMEZONE;
        $vars = array('$targetPlanet' => $this->getTargetPlanet(), '$time' => DateUtil::formatDate(WCF::getLanguage()->get('wot.global.timeFormat'), time()));
        $this->ereport .= WCF::getLanguage()->get('wot.mission.mission' . $this->missionID . '.report.header', $vars);
        $this->ereport .= '</td>
					</tr>';
        // resources
        if ($this->blocks & self::RESOURCES) {
            $array = array();
            foreach ($this->resourceTypes as $resourceType) {
                $key = WCF::getLanguage()->get('wot.global.' . $resourceType);
                $count = $this->getTargetPlanet()->{$resoureType};
                $array[$key] = array('id' => $resourceType, 'name' => WCF::getLanguage()->get('wot.global.' . $resourceType), 'count' => intval(floor($this->getTargetPlanet()->{$resourceType})));
            }
            $this->ereport .= $this->createBlock($array);
        }
        $this->addBlock(self::FLEET, 3, 'fleet');
        $this->addBlock(self::DEFENSE, array(4, 51, 52), 'defense');
        $this->addBlock(self::BUILDINGS, 1, 'buildings');
        $this->addBlock(self::RESEARCH, 2, 'research');
        $this->ereport .= '</table>';
    }
开发者ID:Biggerskimo,项目名称:WOT-Game,代码行数:37,代码来源:EspionageFleet.class.php

示例9: define

define('TEMPLATE_DIR', "templates/");
define('TEMPLATE_NAME', "OpenGame");
define('DEFAULT_LANG', 'de');
// include ugamela
$ugamela_root_path = '/var/www/vhosts/finaluniverse.com/httpdocs/';
include $ugamela_root_path . 'extension.inc';
// mastercook patch
$_SERVER['REQUEST_METHOD'] = '';
$_SERVER['SERVER_PORT'] = '';
// include wcf
if (!defined('WCF_DIR')) {
    define('WCF_DIR', dirname(__FILE__) . '/../wcf/');
}
require_once $ugamela_root_path . 'game/global.php';
//require_once($ugamela_root_path.'wotapi/global.php');
restore_error_handler();
// include some ugamela libs
require $ugamela_root_path . 'includes/vars.php';
require $ugamela_root_path . 'includes/functions.php';
require $ugamela_root_path . 'includes/strings.php';
// load config
$sql = "SELECT *\r\n\t\tFROM ugml_config";
$config = WCF::getDB()->getResultList($sql);
$game_config = array();
foreach ($config as $row) {
    $game_config[$row['config_name']] = $row['config_value'];
}
$vars = array('$time' => DateUtil::formatDate(WCF::getLanguage()->get('wot.global.timeFormat'), time()));
var_dump(WCF::getLanguage()->get('wot.global.timeFormat'));
var_dump(DateUtil::formatDate(WCF::getLanguage()->get('wot.global.timeFormat'), time()));
var_dump(gmstrftime("%d.%m.%Y, %H:%M:%S", time()));
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:executeTest.php

示例10: sendProtocol

 /**
  * Informs admins about the current warnings and deletions
  *
  */
 protected function sendProtocol()
 {
     $generalOptions = $this->data['parameters']['user.inactiveUsers.general'];
     $deleteOptions = $this->data['parameters']['user.inactiveUsers.inactive'];
     $actionDate = DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.dateFormat'), TIME_NOW);
     $mailUserTableHeader = "\n" . str_pad("USER", 26, " ") . str_pad("USERID", 12, " ", STR_PAD_LEFT) . "    " . str_pad("REG-DATE", 20, " ") . "LAST-ACTIVE" . "\n" . str_repeat('-', 80);
     $subject = WCF::getLanguage()->get('wcf.acp.admintools.function.user.inactiveUsers.mailsubject', array('PAGE_TITLE' => PAGE_TITLE, '$actionDate' => $actionDate));
     $message = WCF::getLanguage()->get('wcf.acp.admintools.function.user.inactiveUsers.message', array('PAGE_TITLE' => PAGE_TITLE, '$actionDate' => $actionDate)) . "\n";
     if ($generalOptions['appendNewUsers']) {
         $regTimeStart = mktime(0, 0, 0, (int) date("m", TIME_NOW), (int) date("d", TIME_NOW) - 1, (int) date("Y", TIME_NOW));
         $regTimeEnd = mktime(0, 0, 0, (int) date("m", TIME_NOW), (int) date("d", TIME_NOW), (int) date("Y", TIME_NOW));
         $regDate = DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.dateFormat'), $regTimeStart);
         $sql = "SELECT user.* FROM wcf" . WCF_N . "_user user\n                WHERE registrationDate >= " . $regTimeStart . "\n                AND registrationDate < " . $regTimeEnd . "\n                ORDER BY LOWER(username)";
         $result = WCF::getDB()->sendQuery($sql);
         $users = array();
         while ($row = WCF::getDB()->fetchArray($result)) {
             $users[] = new User(null, $row);
         }
         $message .= "\n\n";
         $message .= WCF::getLanguage()->get('wcf.acp.admintools.function.user.inactiveUsers.newUsers', array('$count' => count($users), '$registrationDate' => $regDate)) . $mailUserTableHeader;
         foreach ($users as $user) {
             $message .= "\n" . str_pad($user->username, 26, " ") . str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . str_pad(DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.timeFormat'), $user->lastActivityTime);
         }
     }
     if (($deleteOptions['action'] == 'warn' || $deleteOptions['action'] == 'warnanddelete') && $generalOptions['sendWarnMail']) {
         $message .= "\n\n";
         $message .= WCF::getLanguage()->get('wcf.acp.admintools.function.user.inactiveUsers.inactive.mailwarned', array('$count' => count($this->warnedInactiveUsers))) . $mailUserTableHeader;
         if (count($this->warnedInactiveUsers)) {
             foreach ($this->warnedInactiveUsers as $user) {
                 $message .= "\n" . str_pad($user->username, 26, " ") . str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . str_pad(DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.timeFormat'), $user->lastActivityTime);
             }
         } else {
             $message .= "\n-";
         }
     }
     if ($deleteOptions['action'] == 'delete' || $deleteOptions['action'] == 'warnanddelete') {
         $message .= "\n\n";
         $message .= WCF::getLanguage()->get('wcf.acp.admintools.function.user.inactiveUsers.inactive.adminmail', array('$count' => count($this->deletedInactiveUsers))) . $mailUserTableHeader;
         if (count($this->deletedInactiveUsers)) {
             foreach ($this->deletedInactiveUsers as $user) {
                 $message .= "\n" . str_pad($user->username, 26, " ") . str_pad($user->userID, 12, " ", STR_PAD_LEFT) . "    " . str_pad(DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.timeFormat'), $user->registrationDate), 20, " ") . DateUtil::formatDate(WCF::getLanguage()->get('wcf.global.timeFormat'), $user->lastActivityTime);
             }
         } else {
             $message .= "\n-";
         }
     }
     $mail = new Mail(array(MAIL_FROM_NAME => MAIL_FROM_ADDRESS), $subject, $message);
     $mail->send();
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:53,代码来源:InactiveUsersAdminToolsFunction.class.php

示例11: readData

 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (!count($_POST)) {
         // set current date
         $this->untilDay = intval(DateUtil::formatDate('%d', null, false, true));
         $this->untilMonth = intval(DateUtil::formatDate('%m', null, false, true));
         $this->untilYear = intval(DateUtil::formatDate('%Y', null, false, true));
     }
     $this->availableTypes = SearchEngine::getSearchTypes();
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:14,代码来源:SearchForm.class.php

示例12: calcAge

 protected static function calcAge($year, $month, $day)
 {
     $age = DateUtil::formatDate('%Y', null, false, true) - $year;
     if (intval(DateUtil::formatDate('%m', null, false, true)) < intval($month)) {
         $age--;
     } else {
         if (intval(DateUtil::formatDate('%m', null, false, true)) == intval($month) && DateUtil::formatDate('%e', null, false, true) < intval($day)) {
             $age--;
         }
     }
     return $age;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:12,代码来源:UserOptionOutputDate.class.php

示例13: getMember

 /**
  * Returns the data of a member.
  * 
  * @param	array		$row
  * @return	array 
  */
 protected function getMember($row)
 {
     $user = new UserProfile(null, $row);
     $username = StringUtil::encodeHTML($row['username']);
     $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
     $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
     foreach ($this->activeFields as $field) {
         switch ($field) {
             // default fields
             case 'username':
                 $userData['username'] = '<div class="containerIconSmall">';
                 if ($user->isOnline()) {
                     $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
                     $userData['username'] .= '<img src="' . StyleManager::getStyle()->getIconPath('onlineS.png') . '" alt="' . $title . '" title="' . $title . '" />';
                 } else {
                     $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
                     $userData['username'] .= '<img src="' . StyleManager::getStyle()->getIconPath('offlineS.png') . '" alt="' . $title . '" title="' . $title . '" />';
                 }
                 $userData['username'] .= '</div><div class="containerContentSmall">';
                 $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
                 $userData['username'] .= '<p><a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
                 if (MODULE_USER_RANK == 1 && $user->getUserTitle()) {
                     $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
                 }
                 $userData['username'] .= '</div>';
                 break;
             case 'registrationDate':
                 $userData['registrationDate'] = DateUtil::formatDate(null, $row['registrationDate']);
                 break;
             case 'lastActivity':
                 $userData['lastActivity'] = '';
                 if ($user->invisible != 1 || WCF::getUser()->getPermission('admin.general.canViewInvisible')) {
                     $userData['lastActivity'] = DateUtil::formatTime(null, $row['lastActivityTime']);
                 }
                 break;
             case 'avatar':
                 if ($user->getAvatar() && ($row['userID'] == WCF::getUser()->userID || WCF::getUser()->getPermission('user.profile.avatar.canViewAvatar'))) {
                     $user->getAvatar()->setMaxHeight(50);
                     $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
                     $userData['avatar'] = '<a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $user->getAvatar()->__toString() . '</a>';
                 } else {
                     $userData['avatar'] = '';
                 }
                 break;
             case 'language':
                 if ($row['languageID'] && $row['languageCode']) {
                     $userData['language'] = '<img src="' . RELATIVE_WCF_DIR . 'icon/language' . ucfirst($row['languageCode']) . 'S.png" alt="' . WCF::getLanguage()->get('wcf.global.language.' . $row['languageCode']) . '" title="' . WCF::getLanguage()->get('wcf.global.language.' . $row['languageCode']) . '" />';
                 } else {
                     $userData['language'] = '';
                 }
                 break;
                 // user options
             // user options
             default:
                 $userData[$field] = '';
                 $option = $this->userOptions->getOptionValue($field, $user);
                 if (!$protectedProfile && $option) {
                     $userData[$field] = $option['optionValue'];
                 }
         }
     }
     return $userData;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:69,代码来源:MembersListPage.class.php

示例14: initUserSymbols

 /**
  * Initializes the user status symbols.
  */
 protected function initUserSymbols()
 {
     // gender icon
     if ($this->user->getUserOption('gender')) {
         $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.gender.' . ($this->user->getUserOption('gender') == 1 ? 'male' : 'female'), array('username' => $this->user->username));
         $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('gender' . ($this->user->getUserOption('gender') == 1 ? 'Male' : 'Female') . 'S.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>';
     }
     // birthday icon
     if ($this->user->birthday) {
         if (substr($this->user->birthday, 5) == DateUtil::formatDate('%m-%d', TIME_NOW, false, true)) {
             $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.birthday', array('username' => $this->user->username, 'age' => $this->user->getAge()));
             $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('birthdayS.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>';
         }
     }
     // friend icon
     if ($this->user->buddy) {
         $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.friend', array('username' => $this->user->username));
         $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('friendsS.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>';
     }
     // banned icon
     if ($this->user->banned) {
         $title = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.banned', array('username' => $this->user->username));
         $this->userSymbols[] = '<img src="' . StyleManager::getStyle()->getIconPath('bannedS.png') . '" alt="" title="' . $title . '" /> <span class="hidden">' . $title . '</span>';
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:28,代码来源:UserProfileFrame.class.php

示例15: execute

 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.user.canPMToUserGroups');
     $sql = "SELECT COUNT(DISTINCT u.userID) AS cnt" . "\n  FROM wcf" . WCF_N . "_user u" . "\n  LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n   AND v.optionValue = '1'" . "\n   AND u.userID != " . $this->userID . "\n   AND g.groupID IN (" . $this->pmData['groupIDs'] . ")";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['cnt'];
     if (!$count > 0) {
         // clear session
         if (isset($this->pmData)) {
             $pmData = WCF::getSession()->getVar('pmData');
             unset($pmData[$this->pmSessionID]);
             WCF::getSession()->register('pmData', $pmData);
         }
         $this->finish('wcf.pmToUgrps.error.noRecipients', 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     }
     if ($count <= $this->limit * $this->loop) {
         $endTime = TIME_NOW;
         $lf = "\n";
         // remove from outbox
         $sql = "UPDATE wcf" . WCF_N . "_pm" . "\n   SET saveInOutbox = 0" . "\n WHERE pmID = " . $this->pmID;
         WCF::getDB()->sendQuery($sql);
         // groups...
         $groups = '';
         $sql = "SELECT groupName" . "\n  FROM wcf" . WCF_N . "_group" . "\n WHERE groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY groupName";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             if (!empty($groups)) {
                 $groups .= ', ';
             }
             $groups .= StringUtil::decodeHTML($row['groupName']);
         }
         // log...
         $log = '';
         $subject = WCF::getLanguage()->get('wcf.pmToUgrps.log.subject', array('$pmID' => $this->pmID)) . ' ' . $this->pmData['subject'];
         if ($this->pmData['enableHtml']) {
             $log .= '<pre>';
         }
         $log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.started', array('$startTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $this->pmData['startTime']))) . $lf;
         $log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.finished', array('$endTime' => DateUtil::formatDate('%d.%m.%Y %H:%M:%S', $endTime))) . $lf;
         $log .= WCF::getLanguage()->get('wcf.pmToUgrps.log.recipients', array('$groups' => $groups, '$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)))) . $lf;
         $log .= str_repeat('-', 60) . $lf;
         if ($this->pmData['enableHtml']) {
             $log .= '</pre>' . $lf;
         }
         $log .= $this->pmData['text'];
         $this->recipientArray = $this->blindCopyArray = array();
         $this->recipientArray[0]['userID'] = $this->userID;
         $this->recipientArray[0]['username'] = $this->username;
         PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $subject, $log, $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => false));
         // clear session
         $pmData = WCF::getSession()->getVar('pmData');
         unset($pmData[$this->pmSessionID]);
         WCF::getSession()->register('pmData', $pmData);
         $this->calcProgress();
         $msg = WCF::getLanguage()->get('wcf.pmToUgrps.finish', array('$count' => StringUtil::decodeHTML(StringUtil::formatInteger($count)), '$startTime' => DateUtil::formatShortTime('%H:%M:%S', $this->pmData['startTime']), '$endTime' => DateUtil::formatShortTime('%H:%M:%S', $endTime)));
         $this->finish($msg, 'index.php?form=PMToUserGroups&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     }
     // get users
     $sql = "SELECT DISTINCT u.userID, u.username" . "\n  FROM wcf" . WCF_N . "_user u" . "\n  LEFT JOIN wcf" . WCF_N . "_user_to_groups g ON (g.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option_value v ON (v.groupID = g.groupID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option o ON (o.optionID = v.optionID)" . "\n WHERE o.optionName = 'user.pm.canUsePm'" . "\n   AND v.optionValue = '1'" . "\n   AND u.userID != " . $this->userID . "\n   AND g.groupID IN (" . $this->pmData['groupIDs'] . ")" . "\n ORDER BY u.userID";
     $this->blindCopyArray = array();
     $i = 0;
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $this->blindCopyArray[$i]['userID'] = $row['userID'];
         $this->blindCopyArray[$i]['username'] = $row['username'];
         $i++;
     }
     if (count($this->blindCopyArray)) {
         if (empty($this->pmID)) {
             $tmp = PMEditor::create($this->draft, $this->recipientArray, $this->blindCopyArray, $this->pmData['subject'], $this->pmData['text'], $this->userID, $this->username, array('enableSmilies' => $this->pmData['enableSmilies'], 'enableHtml' => $this->pmData['enableHtml'], 'enableBBCodes' => $this->pmData['enableBBCodes'], 'showSignature' => $this->pmData['showSignature']));
             if ($tmp->pmID) {
                 $this->pmID = intval($tmp->pmID);
                 $pmData = WCF::getSession()->getVar('pmData');
                 $pmData[$this->pmSessionID]['pmID'] = $this->pmID;
                 WCF::getSession()->register('pmData', $pmData);
                 $mlt = intval($this->pmData['maxLifeTime']);
                 if ($mlt > 0) {
                     $mlt = $this->pmData['startTime'] + 86400 * $mlt;
                 } else {
                     $mlt = 0;
                 }
                 $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_pm_bulk_mailing" . "\n       (pmID, elapsedTime, time, userID)" . "\nVALUES (" . $this->pmID . ", " . $mlt . ", " . $this->pmData['startTime'] . ", " . $this->userID . ")";
                 WCF::getDB()->sendQuery($sql);
             }
         } else {
             $recipientIDs = $inserts = '';
             foreach ($this->blindCopyArray as $k => $v) {
                 $username = WCF::getDB()->escapeString($this->blindCopyArray[$k]['username']);
                 if (!empty($recipientIDs)) {
                     $recipientIDs .= ',';
                 }
                 $recipientIDs .= $this->blindCopyArray[$k]['userID'];
                 if (!empty($inserts)) {
                     $inserts .= ',';
                 }
//.........这里部分代码省略.........
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:101,代码来源:PMToUserGroupsAction.class.php


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