public function __construct($scenario = '', $id = null) { if ($scenario == 'view' && $id != null) { $this->event = Event::getEvent($id); if ($this->event != null) { $this->postItem = $this->event->postItem; if (Yii::app()->user->isCollegeAdmin()) { $this->isPublic = $this->event->college_id == null; } } else { throw new CHttpException(400, 'Cannot found the event post.'); } } else { $this->_new(); } }
/** * */ protected function _parseXML() { $xml_block = $this->_xml->xpath("//page[@id='" . $this->_page . "']"); if (!$xml_block) { trigger_error('Page block "' . $this->_page . '" was not set in pages.xml file!', E_USER_ERROR); return false; } $data = array(\App::option('website.resources_param') => null, \App::option('website.lang_param') => null, \App::option('website.data_param') => null, \App::option('website.meta_tags_param') => Manager::getMetaTags(), \App::option('website.router_param') => new models\Router($this->_page)); //$data[ \App::option( 'website.current_route_param' ) . 'raw' ] = // ( Manager::currentRoute( ) && Manager::getLang( 'suffix' ) ) ? // str_replace( '_' . Manager::getLang( 'suffix' ) , '' , Manager::currentRoute( ) ) : null; $views = $xml_block[0]->views->view; if ($resources = $xml_block[0]->resources) { $blocks = array(); foreach ($resources[0] as $block) { $blocks[] = (string) $block; } $data[\App::option('website.resources_param')] = new models\Resources($blocks, $this->_page); } $data[\App::option('website.lang_param')] = $this->_getTranslator(); $params = array($this->_page, &$data[\App::option('website.data_param')], $data[\App::option('website.lang_param')]); if ($call = (string) $xml_block[0]->attributes()->callback) { \Event::listen('view.callback', $call); } $events = \Event::getEvent('view'); if (@$events['callback']) { \Event::fire('view.callback', $params); } $elements = $this->_xml->xpath("//elements"); if ($elements) { $storage = array(); foreach ($elements[0]->element as $element) { $storage[(string) $element->attributes()->name] = (string) $element; } $data[\App::option('website.elements_param')] = new models\Elements($storage, $data); } $view = \View::make(\App::option('website.views_path') . '/' . $views[0], $data); if (count($views) > 1) { unset($views[0]); foreach ($views as $file) { $child = (string) $file->attributes()->child; $view = $view->nest($child, \App::option('website.views_path') . '/' . $file, $view->getPageVars()); } } return $view; }
protected function sendRegistrationMail($eventMail, $event, $gender, $name, $email, $age, $club, $adress, $category, $message) { $ev = new Event(); $eve = $ev->getEvent($event); $content = "<h1>{$eve['title']} - nová p?ihláška</h1>"; $content .= "Jméno: {$name}"; if ($gender != "") { $content .= "Pohlaví: {$gender}<br>"; } if ($age != "") { $content .= "Ro?ník: {$age}<br>"; } if ($club != "") { $content .= "Klub: {$club}<br>"; } if ($adress != "") { $content .= "Adresa: {$adress}<br>"; } if ($category != "") { $content .= "Kategorie: {$category}<br>"; } if ($message != "") { $content .= "Zpráva: {$message}<br>"; } $content .= "<a href='" . $_SERVER['HTTP_HOST'] . "/index.php?page=calendar_enroll_admin&id={$event}'>Zobrazit p?ihlášky</a>"; //Email information $admin_email = $eventMail; $subject = "Tiary - Nová p?ihláška"; $comment = $content; $header = "From: ununik@gmail.com\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $header .= "X-Priority: 1\r\n"; //send email mail($admin_email, "{$subject}", $comment, $header); }
<?php /** * Created by PhpStorm. * User: ununik * Date: 03.09.2015 * Time: 13:06 */ $eventDB = new Event(); $event = $eventDB->getEvent($_GET['id']); $enrollDB = $eventDB->getEnroll($_GET['id'], $event['author']); $mainTitle = $event['title']; $subscription = nl2br($event['subscription']); $place = nl2br($event['place']); $update = 0; $type = $eventDB->getType($event['type']); $type = $type['cz']; $enroll = $event['enroll']; $time = time(); $starttimestamp = $enrollDB['starttimestamp']; $startEnroll = date("j. n. Y", $starttimestamp); if ($event['timestamp1'] == $event['timestamp2'] || $event['timestamp2'] == 0) { $date = date("j. n. Y", $event['timestamp1']); } else { $date = date("j. n. Y", $event['timestamp1']) . ' - ' . date("j. n. Y", $event['timestamp2']); } if ($event['organisator'] != "") { $organisator = $event['organisator']; } else { $organisator = new Profil($event['id_organisator']); $organisator = $organisator->getName();
/** * @param Event $inflated * @return array */ public function serialize($inflated) { $class = get_class($inflated->getEvent()); return ['occurred' => $inflated->getOccurred()->format('c'), 'event' => ['type' => (string) new \watoki\reflect\type\ClassType($class), 'value' => $this->getSerializer($class)->serialize($inflated->getEvent())]]; }
<?php require "../bcause-core2.php"; $con = new Connection(); $id = $_GET['id']; $event = new Event($con); $event_data = $event->getEvent($id); $json_output = $event->getEventChildrenJSON($con, 1, 0); print $json_output;
* Date: 04.09.2015 * Time: 14:44 */ $OptionsAll = new Event(); $options = ""; $gender = 1; $name = 1; $email = 1; $year = 1; $club = 1; $adress = 0; $category = 0; $link = ""; $day = date("j. n. Y"); $hour = date("H:i"); $event = $OptionsAll->getEvent($_GET['id']); $categories = (include_once "controllers/log/calendar/enroll-setting-category.php"); if (isset($_POST['form'])) { if (isset($_POST['gender']) && $_POST['gender'] == 1) { $gender = 1; } else { $gender = 0; } if (isset($_POST['name']) && $_POST['name'] == 1) { $name = 1; } else { $name = 0; } if (isset($_POST['email']) && $_POST['email'] == 1) { $email = 1; } else {
public function getEventChildrenJSON($con, $max_degree, $child) { $name = $this->name; $id = $this->id; $event_children = $this->getEventChildren($id); $degree = 0; $json_output = ''; if (isset($name)) { # montando o metadata foreach ($event_children as $ec) { if ($ec->quote == '') { $ec->quote = "(no quote yet)"; } $metadata[$ec->event_id] = "'{$ec->quote}' - <a href='{$ec->report_link}'>{$ec->report_news_source}</a>"; if (isset($metadata_insert[$ec->event_id])) { $metadata_insert[$ec->event_id] = $metadata_insert[$ec->event_id] . "</br>" . $metadata[$ec->event_id]; } else { $metadata_insert[$ec->event_id] = $metadata[$ec->event_id]; } } $run = 0; $ids_done = array(); $printed_once = 0; foreach ($event_children as $ecc) { if ($printed_once == 0 && $child == 0) { $json_output = "{\n\"name\": \"{$name}\",\n\"quote\": \"\",\n\"children\": ["; $printed_once = 1; } //print_r($ecc); if (!in_array($ecc->event_id, $ids_done)) { if ($ecc->quote == '') { $ecc->quote = "(no quote yet)"; } if ($run > 0) { $json_output .= ","; } $mt = $metadata_insert[$ecc->event_id]; $json_output .= "{\n \"name\": \"{$ecc->event_name}\",\n \"url\": \"node.php?id={$ecc->event_id}\",\n \"news_url\": \"{$ecc->report_link}\",\n \"quote\": \"{$ecc->quote}\",\n \"metadata\": \"{$mt}\",\n \"children\": ["; # Running sub-children $children_output = ''; if ($degree < $max_degree) { $event2 = new Event($con); $event2_data = $event2->getEvent($ecc->event_id); # Passando o filho tb: se for filho, nao ha necessidade de printar de novo $children_output = $event2->getEventChildrenJSON($con, $max_degree--, 1); //print "AAA: $ecc->event_id\n $children_output\n\n\n"; } $json_output .= $children_output; # Continuando com o parent $json_output .= "]\n }"; $run++; $ids_done[] = $ecc->event_id; } } if ($printed_once == 1) { $json_output .= "]\n }"; } } else { $json_output = ''; } return $json_output; }
public function attachEvent(Event $event) { $this->cal->setComponent($event->getEvent()); return $this; }