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


PHP functions::getCurrentStatus方法代码示例

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


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

示例1: postParseAgendaRecord

 private static function postParseAgendaRecord($thisevent)
 {
     // ------------------------------------------
     // -- 1. First adjust elements of $thisevent
     // ------------------------------------------
     // -- sanitize elements 'speaker' and 'speakerhome' (for seminars, not used for conferences)
     //    output: $thisevent["speakers"] = array("fullname","av_institute","av_salutation")
     $stmp = array();
     if (isset($thisevent["speaker"])) {
         $thisevent["speaker"] = str_replace(" and ", ", ", $thisevent["speaker"]);
         $thisevent["speaker"] = str_replace(" ", " ", $thisevent["speaker"]);
         $thisevent["speaker"] = str_replace(", ", ", ", $thisevent["speaker"]);
         $thisevent["speaker"] = str_replace(" & ", ", ", $thisevent["speaker"]);
         $stmp["nw_fullname"] = $thisevent["speaker"];
         unset($thisevent["speaker"]);
     }
     if (isset($thisevent["speakerhome"])) {
         $thisevent["speakerhome"] = str_replace("University", "U.", $thisevent["speakerhome"]);
         $stmp["av_institute"] = trim($thisevent["speakerhome"]);
         unset($thisevent["speakerhome"]);
     }
     if (!empty($stmp)) {
         $stmp["av_salutation"] = "";
     }
     if (!empty($stmp)) {
         $thisevent["speakers"][] = $stmp;
     }
     // -- standardize labels for element 'registrants'
     if (isset($thisevent["registrant"]) && is_array($thisevent["registrant"])) {
         foreach ($thisevent["registrant"] as $key => $reg) {
             if (isset($thisevent["registrant"][$key]["familyname"])) {
                 $thisevent["registrant"][$key]["av_lastname"] = $thisevent["registrant"][$key]["familyname"];
                 unset($thisevent["registrant"][$key]["familyname"]);
             }
             if (isset($thisevent["registrant"][$key]["firstname"])) {
                 $thisevent["registrant"][$key]["av_firstname"] = $thisevent["registrant"][$key]["firstname"];
                 unset($thisevent["registrant"][$key]["firstname"]);
             }
             if (isset($thisevent["registrant"][$key]["salutation"])) {
                 $thisevent["registrant"][$key]["av_salutation"] = $thisevent["registrant"][$key]["salutation"];
                 unset($thisevent["registrant"][$key]["salutation"]);
             }
             if (isset($thisevent["registrant"][$key]["institution"])) {
                 $thisevent["registrant"][$key]["av_institute"] = $thisevent["registrant"][$key]["institution"];
                 unset($thisevent["registrant"][$key]["institution"]);
             }
             if (isset($thisevent["registrant"][$key]["email"])) {
                 $thisevent["registrant"][$key]["av_email"] = $thisevent["registrant"][$key]["email"];
                 unset($thisevent["registrant"][$key]["email"]);
             }
             if (isset($thisevent["registrant"][$key]["address"])) {
                 $thisevent["registrant"][$key]["av_address"] = $thisevent["registrant"][$key]["address"];
                 unset($thisevent["registrant"][$key]["address"]);
             }
             if (isset($thisevent["registrant"][$key]["city"])) {
                 $thisevent["registrant"][$key]["av_city"] = $thisevent["registrant"][$key]["city"];
                 unset($thisevent["registrant"][$key]["city"]);
             }
             if (isset($thisevent["registrant"][$key]["country"])) {
                 $thisevent["registrant"][$key]["av_residentship"] = $thisevent["registrant"][$key]["country"];
                 unset($thisevent["registrant"][$key]["country"]);
             }
             if (isset($thisevent["registrant"][$key]["phone"])) {
                 $thisevent["registrant"][$key]["av_phone"] = $thisevent["registrant"][$key]["phone"];
                 unset($thisevent["registrant"][$key]["phone"]);
             }
             if (preg_match("/^([^-]*)-([^-]*)-([^-]*)-([^-]*)\$/", $reg["registrationdate"], $res)) {
                 $thisevent["registrant"][$key]["registrationdate"] = $res[3] . "-" . str_pad(functions::monthNameToNumber($res[2]), 2, "0", STR_PAD_LEFT) . "-" . $res[1] . "";
             }
         }
     }
     // -- sanitize element 'room'
     if (isset($thisevent["room"])) {
         $thisevent["room"] = functions::uniformRoomNames($thisevent["room"]);
     }
     // -- add element 'subpath'
     $thisevent["subpath"] = !is_null($GLOBALS["documentClass"]->getPathFromAgendaId($thisevent["id"])) ? $GLOBALS["documentClass"]->getPathFromAgendaId($thisevent["id"]) : "";
     // -- add elements '[start|end][date|time]'
     list($thisevent["startdate"], $thisevent["starttime"]) = explode(" ", $thisevent["start"]);
     list($thisevent["enddate"], $thisevent["endtime"]) = explode(" ", $thisevent["end"]);
     // -- add element 'current'
     $thisevent["current"] = functions::getCurrentStatus($thisevent["startdate"], $thisevent["enddate"]);
     // -- add element 'categoryid'
     //TODO: check if still needed anywhere
     if (0) {
         if (preg_match("/cat=(\\d*)/", $args, $res)) {
             $thisevent["categoryid"] = $res[1];
         }
     }
     // -- add element 'eventtype'
     //TODO: rewrite
     $eventyear = preg_match_all("/^(\\d{4})-/", $thisevent["start"], $m) ? $m[1][0] : FALSE;
     if (!is_null($GLOBALS["documentClass"]->getEventConfig($thisevent["subpath"], "etype"))) {
         $thisevent["eventtype"] = $GLOBALS["documentClass"]->getEventConfig($thisevent["subpath"], "etype");
     } elseif (($programsCategIds = self::getEventByYear("")) && isset($programsCategIds[$eventyear]) && isset($thisevent["id"]) && in_array($thisevent["id"], $programsCategIds[$eventyear])) {
         $thisevent["eventtype"] = "nordita program";
     } elseif (isset($thisevent["title"]) && strpos(strtolower($thisevent["title"]), "conference") !== false) {
         $thisevent["eventtype"] = "conference";
     } elseif (isset($thisevent["title"]) && strpos(strtolower($thisevent["title"]), "workshop") !== false) {
         $thisevent["eventtype"] = "workshop";
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: getEventSessions

 public function getEventSessions($confId)
 {
     $session = $convener = array();
     // --------------------------
     // -- Session chairs (conveners)
     $sql = "SELECT " . "  P.av_firstname," . "  P.av_lastname," . "  P.av_salutation," . "  P.av_institute," . "  P.person_type, " . "  P.parent_id " . "FROM " . "  person as P " . "WHERE " . "  (P.event_id='" . $confId . "') " . "  AND (P.person_type='convener') " . "  AND (NOT ISNULL(P.parent_id))";
     $res = $this->query($sql, IS_TESTSERVER);
     // includes a call to connect
     if ($this->num_rows($res)) {
         while ($r = $this->next_record_assoc($res)) {
             if (!empty($r["parent_id"])) {
                 $convener[$r["person_type"]][$r["parent_id"]][] = array("nw_fullname" => $r["av_firstname"] . " " . $r["av_lastname"], "av_institute" => $r["av_institute"], "av_salutation" => $r["av_salutation"]);
             }
         }
         // end while
     }
     // --------------------------
     // -- Sessions
     $sql = "SELECT " . "  S.session_id," . "  S.title," . "  S.start," . "  S.end " . "FROM " . "  event AS E " . "  LEFT JOIN session as S on E.event_id=S.event_id " . "WHERE " . "  E.event_id='" . $confId . "'";
     $res = $this->query($sql, IS_TESTSERVER);
     // includes a call to connect
     if ($this->num_rows($res)) {
         while ($r = $this->next_record_assoc($res)) {
             if (!empty($r["start"])) {
                 list($startdate, $starttime) = explode(" ", $r["start"]);
                 list($enddate, $endtime) = explode(" ", $r["end"]);
                 $from = strtotime($r["start"]);
                 $to = strtotime($r["end"]);
                 $session[] = array("id" => $r["session_id"], "title" => preg_replace("/^(\\[.*\\])\\s*/", "", $r["title"]), "event_id" => $confId, "start" => $r["start"], "end" => $r["end"], "current" => functions::getCurrentStatus($r["start"], $r["end"]), "period" => functions::readableDateInterval($startdate, $enddate), "duration" => ceil(($to - $from) / 60), "starttime" => $starttime, "startdate" => $startdate, "endtime" => $endtime, "enddate" => $enddate, "from" => $from, "to" => $to, "conveners" => isset($convener["convener"][$r["session_id"]]) ? $convener["convener"][$r["session_id"]] : array());
             }
         }
         // end while
     }
     ksort($session);
     return $session;
 }
开发者ID:,项目名称:,代码行数:36,代码来源:


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