'Text', 'GAConversionLanguage'=>'Text', 'GAConversionFormat'=>'Text', 'GAConversionColor'=>'Text', 'GAConversionLabel'=>'Text', 'GAConversionValue'=>'Int', 'GARemarketingOnly'=>'Boolean' ); static $defaults = array( "GAConversionId" => "994798451", "GAConversionLanguage" => "en", "GAConversionFormat" => "3", "GAConversionColor" => "ffffff", "GAConversionLabel" => "IuM5CK3OzQYQ89at2gM", "GAConversionValue" => 0, "GARemarketingOnly" => false ); static $has_one = array( 'Summit' => 'Summit' ); function getCMSFields() { $fields = parent::getCMSFields(); $summits = Summit::get(); $SummitDropDownField = new DropdownField("SummitID", "Summit", $summits->map("ID", "Name")); $fields->addFieldToTab('Root.Main', $SummitDropDownField); //google analitycs tracking params $fields->addFieldToTab("Root.GoogleAnalitycs",new TextField("GAConversionId","Conversion Id","994798451")); $fields->addFieldToTab("Root.GoogleAnalitycs",new TextField("GAConversionLanguage","Conversion Language","en")); $fields->addFieldToTab("Root.GoogleAnalitycs",new TextField("GAConversionFormat","Conversion Format","3")); $fields->addFieldToTab("Root.GoogleAnalitycs",new ColorField("GAConversionColor","Conversion Color","ffffff")); $fields->addFieldToTab("Root.GoogleAnalitycs",new TextField("GAConversionLabel","Conversion Label","IuM5CK3OzQYQ89at2gM")); $fields->addFieldToTab("Root.GoogleAnalitycs",new TextField("GAConversionValue","Conversion Value","0")); $fields->addFieldToTab("Root.GoogleAnalitycs",new CheckboxField("GARemarketingOnly","Remarketing Only")); return $fields; } } class ConferenceLivePage_Controller extends Page_Controller { /* * Return google tracking script if ?order=complete query string param is present * using settings of current conference page */ function GATrackingCode(){ $request = $this->request; $order = $request->requestVar("order"); $tracking_code = ''; if(isset($order) && $order=="complete"){ //add GA tracking script $page = ConferencePage::get()->byID($this->ID); if($page && !empty($page->GAConversionId) && !empty($page->GAConversionLanguage) && !empty($page->GAConversionFormat) && !empty($page->GAConversionColor) && !empty($page->GAConversionLabel)){ $tracking_code = $this->renderWith("ConferencePage_GA",array( "GA_Data"=> new ArrayData(array( "GAConversionId"=>$page->GAConversionId, "GAConversionLanguage"=>$page->GAConversionLanguage, "GAConversionFormat"=>$page->GAConversionFormat, "GAConversionColor"=>$page->GAConversionColor, "GAConversionLabel"=>$page->GAConversionLabel, "GAConversionValue"=>$page->GAConversionValue, "GARemarketingOnly"=>$page->GARemarketingOnly?"true":"false", )) )); } } return $tracking_code; } function init() { RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of the OpenStack Conference"); parent::init(); } function rss() { $rss = new RSSFeed($this->Children(), $this->Link(), "OpenStack Event Updates RSS Feed", "This feed provides updates related to the OpenStack Spring 2012 Conference and Design Summit.", "Title", "Content"); $rss->outputToBrowser(); } function TrackingLink() { // Get the tracking code from the session if one is set. $source = Session::get('TrackingLinkSource'); // Now look to see if a tracking code was passed in via a URL param. // This will override what's in the session if need be $getVars = $this->request->getVars(); if (isset($getVars['source'])) { $source = Convert::raw2sql($getVars['source']); // Save the source id from the URL param into the session Session::set('TrackingLinkSource', $source); } return $source; } function TrackingLinkScript() { $trackingLink = $this->TrackingLink(); if ($trackingLink) { $script = ' '; return $script; } } public function NewsItems($num = 5) { return ConferenceNewsPage::get()->filter('ParentID',$this->ID)->sort('Created')->limit($num); } public function SubPages($num = 10) { return ConferenceSubPage::get()->filter('ParentID',$this->ID)->sort('Sort','ASC')->limit($num); } }