Beispiel #1
0
    public function showAllUser()
    {
        $i = 0;
        $reply = "";
        $sql = "SELECT * FROM `profile_data` ORDER BY `ID` ASC";
        $con = new Connection();
        $link = $con->getConnection();
        $stmt = $link->prepare($sql);
        $stmt->execute();
        while ($row = $stmt->fetch(PDO::FETCH_BOTH)) {
            $i++;
            $reply .= ' <li id="' . $row["ID"] . ' class="ui-responsive">
	     <a href="href=".../pages/?action=viewProfile&userid=' . $row["ID"] . '&viewer=admin">
	         <img class="profilepic" src="../css/images/logo1.png" alt="ECE-E-learning">
		 <div>
		    <h3 class="user">' . $row["l_name"] . " " . $row["m_name"] . " " . $row["f_name"] . '</h3>
                    <p class="topic"><strong>Reg No:' . $row["regno"] . '. Gender: ' . $row["gender"] . '. Marital Status: ' . $row["m_status"] . '.</strong></p>
                    <p><strong>' . $row["email"] . '. Phone:' . $row["phone"] . '</strong></p>		    
                    <p><strong>' . $row["address"] . '.</strong></p>
		    </div>
                    <div class="ui-li-aside ui-responsive"><p><strong>Joind:' . gmstrftime("%a, %b %d, %Y. Time:%I:%M:%S.%p", strtotime($row["signup_date"])) . '</strong></p>
		     <p>Last login:<strong>4:48</strong></p>
		     <p >Status:<strong class="status">' . $this->getUserStatus($row["user_id"]) . '</strong></p>
		     
		     </div>
                </a>
		
                <a href="#" class="delete">Disable</a>
            </li>';
        }
        //$stmt ->closeCursor();
        return $reply;
    }
Beispiel #2
0
 /**
  * Serve the iCalendar feed (valid for both download as .ics and webcal:// protocol)
  *
  * @return	@e void
  */
 public function downloadIcalFeed()
 {
     //-----------------------------------------
     // Get main view class
     //-----------------------------------------
     $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('calendar') . '/modules_public/calendar/view.php', 'public_calendar_calendar_view');
     $calendar = new $classToLoad($this->registry);
     $calendar->makeRegistryShortcuts($this->registry);
     $calendar->initCalendar();
     //-----------------------------------------
     // Load (all) events
     //-----------------------------------------
     $calendar->calendarGetEventsSQL(gmstrftime('%m'), gmstrftime('%Y'), array('timenow' => '1', 'timethen' => '2000000000', 'cal_id' => $this->calendar['cal_id'], 'honor_permissions' => true, 'no_date_convert' => true));
     $events = $calendar->calendarGetAllEvents();
     //-----------------------------------------
     // Load iCalendar class
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . "/sources/icalendar.php", 'app_calendar_classes_icalendarOutput', 'calendar');
     $iCalendar = new $classToLoad($this->registry, $this->calendar['cal_id']);
     //-----------------------------------------
     // Send data to iCalendar class and get output
     //-----------------------------------------
     foreach ($events as $event) {
         $event = $calendar->calendarMakeEventHTML($event, true);
         $iCalendar->addEvent($event);
     }
     $feed = $iCalendar->buildICalendarFeed();
     //-----------------------------------------
     // Output
     //-----------------------------------------
     @header("Content-type: text/calendar; charset=" . IPS_DOC_CHAR_SET);
     @header("Content-Disposition: inline; filename=calendarEvents.ics");
     print $feed;
     exit;
 }
Beispiel #3
0
function filter_time($x,$t){
$y=gmstrftime('%H:%M',$x);

switch ($t) {
    case 1: //for time in H:m
	        $null=gmstrftime('%H:%M',"0");
            if ($y==$null){
                $x="";
	      	}
                elseif($y<$null){
	            $x=gmstrftime('%H:%M',$x);
	        }
                else
            $x=gmstrftime('%H:%M',$x);
        return $x;
      break;
    case 2: //for day
        echo "i equals 1";
        break;
    case 3:
        echo "i equals 2";
        break;
}

}
Beispiel #4
0
 /**
  * create marker with given data
  * optionally add debug_backtrace and marker background color
  * @param array $data
  *
  * @example marker(array('marker name'))
  * @example marker(array('marker name', debug_backtrace()))
  * @example marker(array('marker name', debug_backtrace(), '#000000'))
  */
 public static function marker($data)
 {
     $defaultData = array('', null, null);
     $data = array_merge($data, $defaultData);
     if ((bool) self::$tracerOn) {
         ++self::$traceStep;
         $time = microtime(true);
         $time = preg_split('#\\.|,#', $time);
         if (!isset($time[1])) {
             $time[1] = 0;
         }
         $markerTime = gmstrftime('%d-%m-%Y<br/>%H:%M:%S:', $time[0]) . $time[1];
         if (!$data[1]) {
             $data[1] = array(array('file' => '', 'line' => '', 'function' => '', 'class' => '', 'type' => '', 'args' => ''));
         }
         if (isset($data[1][0]['args']) && is_array($data[1][0]['args'])) {
             foreach ($data[1][0]['args'] as $arg => $val) {
                 if (is_object($val)) {
                     $data[1][0]['args'][$arg] = serialize($val);
                 }
             }
         }
         self::$session['markers'][] = array('time' => $markerTime, 'name' => $data[0], 'debug' => $data[1], 'color' => $data[2]);
     }
 }
 function onOpen() {
   $this->removeAll();
   $d = $this->getDocument();
   $l = $d->getLocale();
       
   if($k = $this->getAttribute('key')) {
     $time = $d->getVariable($k, time());
   } else {
     $time = time();
   }
   
   if($l) {
     // If we have locale, we can use it to format values
     $f = $this->getAttribute('format', null);
     // Check if we have to format date or time
     switch($this->getAttribute('mode')) {
       case 'date':
         $rv = $l->formatDate($time, $this->formats[$f]);
         break;
       case 'time':
         $rv = $l->formatTime($time, $this->formats[$f]);
         break;
       default:  
        $rv = $l->formatDateTime($time, $f);
     }
   } else {
     // Else pass to strftime()
     $f = $this->getAttribute('format', '%H:%M:%S GMT');
     $rv = gmstrftime($f, $time);
   }
     
   $n = new HTMLTextNode($this, $rv);
   $this->addNode($n);
   return self::PROCESS_BODY;
 }
Beispiel #6
0
 /**
  * list users
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!($delta = SQL::count($result))) {
         return $text;
     }
     // flag idle users
     $idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
     // process all items in the list
     $count = 0;
     $items = array();
     while ($item = SQL::fetch($result)) {
         // url to view the user
         $url = Users::get_permalink($item);
         // initialize variables
         $prefix = $suffix = '';
         // signal restricted and private users
         if (isset($item['active']) && $item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif (isset($item['active']) && $item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // signal locked profiles
         if (isset($item['capability']) && $item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if (isset($item['full_name']) && $item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10));
             $hover = $item['nick_name'];
         } else {
             $label = ucfirst(Skin::strip($item['nick_name'], 10));
             $hover = $item['full_name'];
         }
         // flag idle users
         if (!isset($item['click_date']) || $item['click_date'] < $idle) {
             $class = 'idle user';
         } else {
             $class = 'user';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, $class, NULL, $hover);
         // provide only some results
         if (++$count >= 5) {
             break;
         }
     }
     // end of processing
     SQL::free($result);
     // turn this to some text
     $text = Skin::build_list($items, 'comma');
     // some indications on the number of connections
     if ($delta -= $count) {
         $text .= ', ...';
     }
     return $text;
 }
Beispiel #7
0
function mycal_build_calendar($year, $month, $day, $events = array())
{
    $prevnext = array('&laquo;' => '/event/calendar/' . _mycal_format_date($year, $month - 1), '&raquo;' => '/event/calendar/' . _mycal_format_date($year, $month + 1));
    $first_day = 0;
    // First day is Sunday
    $first_of_month = gmmktime(0, 0, 0, $month, 1, $year);
    $day_names = array();
    // January 4, 1970 was a Sunday
    for ($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400) {
        $day_names[$n] = ucfirst(gmstrftime('%A', $t));
        #%A means full textual day name
    }
    list($month, $year, $month_name, $weekday) = explode(',', gmstrftime('%m,%Y,%B,%w', $first_of_month));
    $weekday = ($weekday + 7 - $first_day) % 7;
    // Adjust for $first_day
    $title = htmlentities(ucfirst($month_name)) . '&nbsp;' . $year;
    @(list($p, $pl) = each($prevnext));
    @(list($n, $nl) = each($prevnext));
    $p = '<a class="calendar-prev" href="' . htmlspecialchars($pl) . '">' . $p . '</a>';
    $n = '<a class="calendar-next" href="' . htmlspecialchars($nl) . '">' . $n . '</a>';
    $calendar = '<table class="calendar" summary="">' . "\n";
    $calendar .= '<caption class="calendar-month">' . $p . '<a href="/event/calendar/' . _mycal_format_date($year, $month) . '" class="calendar-title">' . $title . '</a>' . $n . "<br class=\"clear\"/></caption>\n<tr>\n";
    foreach ($day_names as $d) {
        $calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities(substr($d, 0, 3)) . ' </th>';
    }
    $calendar .= "</tr>\n<tr>";
    // Initial "empty" days
    if ($weekday > 0) {
        for ($i = 0; $i < $weekday; $i++) {
            $calendar .= '<td class="calendar-empty">&nbsp;</td>';
        }
    }
    for ($d = 1, $days_in_month = gmdate('t', $first_of_month); $d <= $days_in_month; $d++, $weekday++) {
        if ($weekday == 7) {
            // Start a new week
            $weekday = 0;
            $calendar .= "</tr>\n<tr>";
        }
        $class = 'calendar-day';
        $curr = date('Y-m-d', mktime(0, 0, 0, $month, $d, $year));
        if (isset($events[$curr])) {
            $class .= ' calendar-day-events';
            $content = '<a href="/event/calendar/' . _mycal_format_date($year, $month, $d) . '">' . $d . '</a>';
        } else {
            $content = $d;
        }
        if (null !== $day && $d == $day) {
            $class .= ' calendar-day-selected';
        }
        $calendar .= '<td class="' . $class . '">' . $content . '</td>';
    }
    // Remaining "empty" days
    if ($weekday != 7) {
        for ($i = 0; $i < 7 - $weekday; $i++) {
            $calendar .= '<td class="calendar-empty">&nbsp;</td>';
            #initial 'empty' days
        }
    }
    return $calendar . "</tr>\n</table>\n";
}
Beispiel #8
0
 function process()
 {
     global $CONFIG;
     $this->template_name = 'pages/team/ical.tpl';
     $this->smarty->assign('team', $this->team);
     $this->smarty->assign('short_league_name', variable_get('app_org_short_name', 'League'));
     # Our timezone is specified as US/Eastern, but ical wants US-Eastern.  bleh.
     $timezone = preg_replace("!/!", "-", $CONFIG['localization']['local_tz']);
     $this->smarty->assign('timezone', $timezone);
     /*
      * Grab schedule info
      */
     $games = Game::load_many(array('either_team' => $this->team->team_id, 'published' => 1, '_order' => 'g.game_date DESC,g.game_start,g.game_id'));
     // We'll be outputting an ical
     header('Content-type: text/calendar; charset=UTF-8');
     // Prevent caching
     header("Cache-Control: no-cache, must-revalidate");
     // get domain URL for signing games
     $arr = explode('@', variable_get('app_admin_email', "@{$short_league_name}"));
     $this->smarty->assign('domain_url', $arr[1]);
     // date stamp this file
     // MUST be in UTC
     $this->smarty->assign('now', gmstrftime('%Y%m%dT%H%M%SZ'));
     while (list(, $game) = each($games)) {
         $opponent_id = $game->home_id == $this->team->team_id ? $game->away_id : $game->home_id;
         $game->opponent = Team::load(array('team_id' => $opponent_id));
         $game->field = Field::load(array('fid' => $game->fid));
     }
     $this->smarty->assign('games', $games);
 }
Beispiel #9
0
    public function publish()
    {
        $link = 'http://projet.idleman.fr/PHPipe';
        $rss = '<?xml version="1.0" encoding="UTF-8"?>
		<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
		<channel>
					<title>' . $this->title . '</title>
					<atom:link href="' . $this->link . '" rel="self" type="application/rss+xml"/>
					<link>' . $this->link . '</link>
					<description>Aggrégation des flux</description>
					<language>fr-fr</language>
					<copyright>DWTFYW</copyright>
					<pubDate>' . date('r', gmstrftime(time())) . '</pubDate>
					<lastBuildDate>' . date('r', gmstrftime(time())) . '</lastBuildDate>
					<sy:updatePeriod>hourly</sy:updatePeriod>
					<sy:updateFrequency>1</sy:updateFrequency>
					<generator>' . $this->title . '</generator>';
        foreach ($this->events as $event) {
            $rss .= '<item>
						<title><![CDATA[' . $event->title . ']]></title>
						<link>' . $event->link . '</link>
						<pubDate>' . date('r', gmstrftime(strtotime($event->date))) . '</pubDate>
						<guid isPermaLink="true">' . $event->link . '</guid>
						<description>
						<![CDATA[' . $event->description . ']]>
						</description>
						<content:encoded><![CDATA[' . $event->content . ']]></content:encoded>
						<category>' . implode('|', $event->categories) . '</category>
						<dc:creator>' . $event->creator . '</dc:creator>
					</item>';
        }
        $rss .= '</channel></rss>';
        return $rss;
    }
Beispiel #10
0
 function dspSkinCSS_PageDidLoad()
 {
     // determine skin type/skin/theme
     $cssTemplate = $skinName = $skinThemeName = NULL;
     @(list(, , , $cssTemplate, $skinTypeName, $skinName, $skinThemeName) = split('/', $_SERVER['PATH_INFO']));
     $cssFilePath = WFWebApplication::appDirPath(WFWebApplication::DIR_SKINS) . '/' . $skinTypeName . '/' . $skinName . '/' . $cssTemplate;
     if (!file_exists($cssFilePath)) {
         header("HTTP/1.0 404 Not Found");
         print "No css file at: {$cssFilePath}";
         exit;
     }
     // set the skin's wrapper information
     $skin = $this->invocation->rootSkin();
     $skin->setDelegateName($skinTypeName);
     $skin->setSkin($skinName);
     $skin->setTemplateType(WFSkin::SKIN_WRAPPER_TYPE_RAW);
     $skin->setValueForKey($skinThemeName, 'skinThemeName');
     // load the theme vars into our smarty for this module
     $this->requestPage->assign('skinThemeVars', $skin->valueForKey('skinManifestDelegate')->loadTheme($skinThemeName));
     $this->requestPage->assign('cssFilePath', $cssFilePath);
     $this->requestPage->assign('skinDir', $skin->getSkinDir());
     $this->requestPage->assign('skinDirShared', $skin->getSkinDirShared());
     header("Content-Type: text/css");
     // make CSS cacheable for a day at least
     $seconds = 24 * 60 * 60;
     // cache control - we can certainly safely cache the search results for 15 minutes
     header('Pragma: ');
     // php adds Pragma: nocache by default, so we have to disable it
     header('Cache-Control: max-age=' . $seconds);
     // Format: Fri, 30 Oct 1998 14:19:41 GMT
     header('Expires: ' . gmstrftime("%a, %d %b %Y %T ", time() + $seconds) . ' GMT');
 }
Beispiel #11
0
 public function __construct()
 {
     parent::__construct();
     $this->lastModified = gmstrftime("%a, %d %b %Y %T %Z", time());
     $this->etag = '"' . dechex(mt_rand()) . ':' . dechex(mt_rand()) . '"';
     $this->timer = new Timer();
 }
Beispiel #12
0
 public function main($UrlAppend = NULL, $get = NULL, $post = NULL)
 {
     if (!$_REQUEST['server_id'] || !$_REQUEST['sbm']) {
         return $this->_assign;
     }
     $data = array('user' => trim($_GET['user']), 'userType' => trim($_GET['userType']), 'regBeginTime' => strtotime(trim($_GET['regBeginTime'])), 'regEndTime' => strtotime(trim($_GET['regEndTime'])), 'loginBeginTime' => strtotime(trim($_GET['loginBeginTime'])), 'loginEndTime' => strtotime(trim($_GET['loginEndTime'])), 'pageSize' => PAGE_SIZE, 'page' => max(1, intval($_GET['page'])));
     $postData = $this->_gameObject->getPostData($post);
     $postData = array_merge($data, $postData);
     $data = $this->getResult($UrlAppend, $get, $postData);
     if ($data['status'] == 1) {
         if ($data['data']['list']) {
             foreach ($data['data']['list'] as &$player) {
                 $player['id'] = $this->_d2s($player['id']);
                 $player['createTime'] = date('Y-m-d H:i:s', $player['createTime'] / 1000);
                 $player['loginTime'] = date('Y-m-d H:i:s', $player['loginTime'] / 1000);
                 $player['onLineTime'] = gmstrftime('%H:%M:%S', $player['onLineTime'] / 1000);
             }
             $this->_loadCore('Help_Page');
             //载入分页工具
             $helpPage = new Help_Page(array('total' => $data['data']['total'], 'perpage' => PAGE_SIZE));
             $this->_assign['dataList'] = $data['data']['list'];
             $this->_assign['pageBox'] = $helpPage->show();
         }
     } else {
         $this->_assign['connectError'] = 'Error Message:' . $data['info'];
     }
     if ($this->_isAjax()) {
         $this->ajaxReturn(array('status' => $data['status'], 'info' => $data['info'], 'data' => $this->_assign));
     }
     return $this->_assign;
 }
Beispiel #13
0
 /**
  * @param number $bos_time The default value is 0, most of time this paramter
  *   only used in test cases.
  *
  * @return string
  */
 static function bceTimeNow($bos_time = 0)
 {
     if ($bos_time > 0) {
         return gmstrftime("%Y-%m-%dT%H:%M:%SZ", $bos_time);
     }
     return gmstrftime("%Y-%m-%dT%H:%M:%SZ", time());
 }
Beispiel #14
0
 public function index()
 {
     switch ($_GET['ext']) {
         case 'js':
             $this->mimetype = 'application/x-javascript';
             break;
         case 'rss':
             $this->mimetype = 'application/rss+xml';
             break;
         case 'xml':
             $this->mimetype = 'text/xml';
             break;
         case 'css':
             $this->mimetype = 'text/css';
             break;
         default:
             $this->mimetype = 'text/plain';
     }
     $asset_file = dirname(__FILE__) . '/../assets/' . $_GET['dir'] . '/' . $_GET['file'] . '.' . $_GET['ext'];
     $this->response->body = file_get_contents($asset_file);
     $this->response->add_header('Content-Type', $this->mimetype);
     $this->response->add_header('Cache-Control', 'max-age=86400');
     $this->response->add_header('Pragma', 'max-age=86400');
     $this->response->add_header('Last-Modified', gmstrftime('%a, %d %b %Y %H:%M:%S %Z', filemtime($asset_file)));
     $this->response->add_header('Date', gmstrftime('%a, %d %b %Y %H:%M:%S %Z'));
     $this->response->add_header('Expires', gmstrftime('%a, %d %b %Y %H:%M:%S %Z', time() + 86400));
     $this->render(NULL);
 }
Beispiel #15
0
 static function timestamp_to_datetime($t = NULL)
 {
     if ($t === NULL) {
         $t = time();
     }
     return gmstrftime('%Y%m%dT%H%M%SZ', $t);
 }
Beispiel #16
0
function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 1, $pn = array())
{
    $first_of_month = gmmktime(0, 0, 0, $month, 1, $year);
    #remember that mktime will automatically correct if invalid dates are entered
    # for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
    # this provides a built in "rounding" feature to generate_calendar()
    $day_names = array();
    #generate all the day names according to the current locale
    for ($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400) {
        #January 4, 1970 was a Sunday
        $day_names[$n] = ucfirst(gmstrftime('%A', $t));
    }
    #%A means full textual day name
    list($month, $year, $month_name, $weekday) = explode(',', gmstrftime('%m,%Y,%B,%w', $first_of_month));
    $weekday = ($weekday + 7 - $first_day) % 7;
    #adjust for $first_day
    $title = htmlentities(ucfirst($month_name)) . '&nbsp;' . $year;
    #note that some locales don't capitalize month and day names
    #Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
    @(list($p, $pl) = each($pn));
    @(list($n, $nl) = each($pn));
    #previous and next links, if applicable
    $p = "&nbsp;<span class=\"calendar-prev\"><a href=\"javascript:sndReq('calendar','&year={$year}&month=" . ($month - 1) . "','calendar');\">&lt;&lt;</a></span>&nbsp;";
    $n = "&nbsp;<span class=\"calendar-next\"><a href=\"javascript:sndReq('calendar','&year={$year}&month=" . ($month + 1) . "','calendar');\">&gt;&gt;</a></span>";
    $calendar = '<table class="b2calendartable">' . "\n" . '<caption class="b2calendarmonth">' . $p . '<span class="noclear">' . ($month_href ? '<a href="' . htmlspecialchars($month_href) . '">' . $title . '</a>' : $title) . '</span>' . $n . "</caption>\n<tr>";
    if ($day_name_length) {
        #if the day names should be shown ($day_name_length > 0)
        #if day_name_length is >3, the full name of the day will be printed
        foreach ($day_names as $d) {
            $calendar .= '<th class="b2calendarheadercell" abbr="' . htmlentities($d) . '">' . htmlentities($day_name_length < 4 ? substr($d, 0, $day_name_length) : $d) . '</th>';
        }
        $calendar .= "</tr>\n<tr>";
    }
    if ($weekday > 0) {
        $calendar .= '<td colspan="' . $weekday . '">&nbsp;</td>';
    }
    #initial 'empty' days
    for ($day = 1, $days_in_month = gmdate('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++) {
        if ($weekday == 7) {
            $weekday = 0;
            #start a new week
            $calendar .= "</tr>\n<tr class=\"b2calendarrow\">";
        }
        if (isset($days[$day]) and is_array($days[$day])) {
            @(list($link, $classes, $content) = $days[$day]);
            if (is_null($content)) {
                $content = $day;
            }
            $calendar .= '<td' . ($classes ? ' class="' . htmlspecialchars($classes) . '">' : '>') . ($link ? '<a href="' . htmlspecialchars($link) . '">' . $content . '</a>' : $content) . '</td>';
        } else {
            $calendar .= "<td" . ($day == date("d") && $month == date("m") ? " class=\"b2calendartoday\"" : " class=\"b2calendarcell\"") . "><a href=\"javascript:sndReq('view','test&day={$day}&month={$month}&year={$year}','contents');\">{$day}</a></td>";
        }
    }
    if ($weekday != 7) {
        $calendar .= '<td colspan="' . (7 - $weekday) . '">&nbsp;</td>';
    }
    #remaining "empty" days
    return $calendar . "</tr>\n</table>\n";
}
Beispiel #17
0
 static function formatGMT($format = '%c', $time = null)
 {
     if (isset($time)) {
         return gmstrftime(_t($format), $time);
     } else {
         return gmstrftime(_t($format));
     }
 }
Beispiel #18
0
 public function date($format = '%Y-%m-%d %H:%M:%S')
 {
     $date = $this->get('date_gmt') ?: $this->get('date');
     if (!$date) {
         return '';
     }
     return gmstrftime($format, strtotime($date));
 }
Beispiel #19
0
 /**
  * @dataProvider providerCalculate_cycle_next
  */
 public function testCalculate_cycle_next($unit, $start, $result)
 {
     $deliverable = new org_openpsa_sales_salesproject_deliverable_dba();
     $deliverable->unit = $unit;
     $scheduler = new org_openpsa_invoices_scheduler($deliverable);
     $next_cycle = $scheduler->calculate_cycle_next($start);
     $this->assertEquals(gmstrftime('%Y-%m-%d %H:%M:%S', $result), gmstrftime('%Y-%m-%d %H:%M:%S', $next_cycle), 'Wrong value for unit ' . $unit . ', start value: ' . gmstrftime('%Y-%m-%d %H:%M:%S', $start));
 }
 public function store($certificate, $expiry_date)
 {
     $stm = $this->prepare("UPDATE certificates SET certificate=:certificate, expires=:expiry_date WHERE id=:serial");
     $stm->execute(array(":certificate" => $certificate, ":expiry_date" => gmstrftime("%Y-%m-%d %H:%M:%S", $expiry_date), ":serial" => $this->assigned_serial));
     if ($this->inTransaction()) {
         $this->commit();
     }
 }
Beispiel #21
0
function cond_headers($time, $etag = null)
{
    if (isset($time)) {
        header('Last-Modified: ' . gmstrftime('%a, %d %b %Y %H:%M:%S GMT', $time));
    }
    if (isset($etag)) {
        header('ETag: W/' . cond_quote_etag($etag));
    }
}
Beispiel #22
0
 protected function end()
 {
     $this->info('-------------< End >-------------');
     $runtime = Carbon::now()->diffInSeconds($this->startTime);
     $signature = substr($this->signature, 0, stripos($this->signature, ' ')) ?: $this->signature;
     $parame = ['argument' => array_except($this->argument(), ['command']), 'option' => array_except($this->option(), ['help', 'verbose', 'version', 'ansi', 'no-ansi', 'no-interaction', 'env'])];
     $this->table(['命令', '开始时间', '结束时间', '用时'], [[$signature, $this->startTime, Carbon::now(), gmstrftime('%H时%M分%S秒', $runtime)]]);
     CommandHistory::saveData(['signature' => $signature, 'parame' => $parame, 'description' => $this->description, 'starttime' => $this->startTime, 'endtime' => Carbon::now(), 'runtimestring' => gmstrftime('%H时%M分%S秒', $runtime), 'runtime' => $runtime]);
 }
Beispiel #23
0
 public function getPracticeTimeAttribute($value)
 {
     if (!empty($value)) {
         $temp = gmstrftime('%M %S', $value);
         $temp = explode(' ', $temp);
         $value = $temp[0] . ':' . $temp[1];
     }
     return $value;
 }
Beispiel #24
0
 public function getDurationAttribute($value)
 {
     if (!empty($value)) {
         $temp = gmstrftime("%H %M %S", $value);
         $temp_array = explode(' ', $temp);
         $value = $temp_array[0] . '小时' . $temp_array[1] . '分' . $temp_array[2] . '秒';
     }
     return $value;
 }
Beispiel #25
0
 public function __construct($id = NULL)
 {
     $this->_last_build_date = gmstrftime('%a, %d %b %Y %R GMT', time());
     if (!$id) {
         return;
     }
     $this->id = (int) $id;
     $this->init();
 }
Beispiel #26
0
/**
 * 秒数转时间
 *
 * @param int $seconds
 * @return string
 */
function seconds_to_time($seconds)
{
    $hours = (int) ($seconds / 3600);
    if ($hours) {
        return gmstrftime('%H:%M:%S', $seconds);
    } else {
        return gmstrftime('%M:%S', $seconds);
    }
}
Beispiel #27
0
 /**
  * list comments as successive notes in a thread
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return formatted text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // build a list of comments
     while ($item = SQL::fetch($result)) {
         // automatic notification
         if ($item['type'] == 'notification') {
             $text = '<dd class="thread_other" style="font-style: italic;">' . ucfirst(trim($item['description'])) . '</dd>' . $text;
         } else {
             // link to user profile -- open links in separate window to enable side browsing of participant profiles
             if ($item['create_id']) {
                 if ($user = Users::get($item['create_id']) && $user['full_name']) {
                     $hover = $user['full_name'];
                 } else {
                     $hover = NULL;
                 }
                 $author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'], TRUE, $hover);
             } else {
                 $author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'], TRUE);
             }
             // differentiate my posts from others
             if (Surfer::get_id() && $item['create_id'] == Surfer::get_id()) {
                 $style = ' class="thread_me"';
             } else {
                 $style = ' class="thread_other"';
             }
             // a clickable label
             $stamp = '#';
             // flag old items on same day
             if (!strncmp($item['edit_date'], gmstrftime('%Y-%m-%d %H:%M:%S', time()), 10)) {
                 $stamp = Skin::build_time($item['edit_date']);
             } else {
                 $stamp = Skin::build_date($item['edit_date']);
             }
             // append this at the end of the comment
             $stamp = ' <div style="float: right; font-size: x-small">' . Skin::build_link(Comments::get_url($item['id']), $stamp, 'basic', i18n::s('Edit')) . '</div>';
             // package everything --change order to get oldest first
             $text = '<dt' . $style . '>' . $author . '</dt><dd' . $style . '>' . $stamp . ucfirst(trim($item['description'])) . '</dd>' . $text;
         }
     }
     // end of processing
     SQL::free($result);
     // finalize the returned definition list
     if ($text) {
         $text = '<dl>' . $text . '</dl>';
     }
     // process yacs codes
     $text = Codes::beautify($text);
     return $text;
 }
Beispiel #28
0
function Auth_OpenID_mkNonce($when = null)
{
    // Generate a nonce with the current timestamp
    $salt = Auth_OpenID_CryptUtil::randomString(6, Auth_OpenID_Nonce_CHRS);
    if ($when === null) {
        $when = gmmktime();
    }
    $time_str = gmstrftime(Auth_OpenID_Nonce_TIME_FMT, $when);
    return $time_str . $salt;
}
Beispiel #29
0
function returnDayNameArray()
{
    // taken from PHP Calendar (version 2.3), written by Keith Devens
    // http://keithdevens.com/software/php_calendar
    $day_names = array();
    for ($n = 0, $t = 3 * 86400; $n < 7; $n++, $t += 86400) {
        $day_names[$n] = ucfirst(gmstrftime('%A', $t));
    }
    return $day_names;
}
 /**
  *
  * @author francisco.mancardi@gmail.com>
  **/
 private function helperParseDate($date2parse)
 {
     $ret = null;
     if (!is_null($date2parse)) {
         $ret = date_parse($date2parse);
         $ret = gmmktime(0, 0, 0, $ret['month'], $ret['day'], $ret['year']);
         $ret = $this->l18n['duedate'] . gmstrftime("%d %b %Y", $ret);
     }
     return $ret;
 }