/**
  * A method that echos the HTML for this field.
  */
 function display()
 {
     $oStartDate = $this->getStartDate();
     $startDateStr = is_null($oStartDate) ? '' : $oStartDate->format('%Y-%m-%d');
     $oEndDate = $this->getEndDate();
     $endDateStr = is_null($oEndDate) ? '' : $oEndDate->format('%Y-%m-%d');
     echo "\n        <select name='{$this->_name}_preset' id='{$this->_name}_preset' onchange='{$this->_name}FormChange(" . ($this->_autoSubmit ? 1 : 0) . ")' tabindex='" . $this->_tabIndex++ . "'>";
     foreach ($this->_fieldSelectionNames as $v => $n) {
         $selected = $v == $this->_fieldSelectionValue ? " selected='selected'" : '';
         echo "\n            <option value='{$v}'{$selected}>{$n}</option>";
     }
     echo "\n        </select>\n        <label for='{$this->_name}_start' style='margin-left: 1em'> " . $this->oTrans->translate('From') . "</label>\n        <input class='date' name='{$this->_name}_start' id='{$this->_name}_start' type='text' value='{$startDateStr}' tabindex='" . $this->_tabIndex++ . "' />\n        <input type='image' src='" . OX::assetPath() . "/images/icon-calendar.gif' id='{$this->_name}_start_button' align='absmiddle' border='0' tabindex='" . $this->_tabIndex++ . "' />\n        <label for='{$this->_name}_end' style='margin-left: 1em'> " . $this->oTrans->translate('To') . "</label>\n        <input class='date' name='{$this->_name}_end' id='{$this->_name}_end' type='text' value='{$endDateStr}' tabindex='" . $this->_tabIndex++ . "' />\n        <input type='image' src='" . OX::assetPath() . "/images/icon-calendar.gif' id='{$this->_name}_end_button' align='absmiddle' border='0' tabindex='" . $this->_tabIndex++ . "' />\n        <script type='text/javascript'>\n        <!--\n        Calendar.setup({\n            inputField : '{$this->_name}_start',\n            ifFormat   : '%Y-%m-%d',\n            button     : '{$this->_name}_start_button',\n            align      : 'Bl',\n            weekNumbers: false,\n            firstDay   : " . ($GLOBALS['pref']['ui_week_start_day'] ? 1 : 0) . ",\n            electric   : false\n        })\n        Calendar.setup({\n            inputField : '{$this->_name}_end',\n            ifFormat   : '%Y-%m-%d',\n            button     : '{$this->_name}_end_button',\n            align      : 'Bl',\n            weekNumbers: false,\n            firstDay   : " . ($GLOBALS['pref']['ui_week_start_day'] ? 1 : 0) . ",\n            electric   : false\n        })\n        // Tabindex handling\n        {$this->_name}TabIndex = " . ($this->_tabIndex - 4) . ";\n        // Functions\n        function {$this->_name}Reset()\n        {\n            document.getElementById('{$this->_name}_start').value = '{$startDateStr}';\n            document.getElementById('{$this->_name}_start').value = '{$endDateStr}';\n            document.getElementById('{$this->_name}_preset').value = '{$this->_fieldSelectionValue}';\n        }\n        function {$this->_name}FormSubmit() {\n            submitForm();\n            return false;\n        }\n        function {$this->_name}FormChange(bAutoSubmit)\n        {\n            var o = document.getElementById('{$this->_name}_preset');\n            var {$this->_name}SelectName = o.options[o.selectedIndex].value;\n            var specific = {$this->_name}SelectName == 'specific';";
     $oTmpDaySpan = new OA_Admin_DaySpan();
     foreach ($this->_fieldSelectionNames as $v => $n) {
         if ($v != 'specific') {
             if ($v != 'all_events') {
                 $oTmpDaySpan->setSpanPresetValue($v);
                 $oTmpStartDate = $oTmpDaySpan->getStartDate();
                 $sTmpStartDate = $oTmpStartDate->format('%Y-%m-%d');
                 $oTmpEndDate = $oTmpDaySpan->getEndDate();
                 $sTmpEndDate = $oTmpEndDate->format('%Y-%m-%d');
             } else {
                 $sTmpStartDate = '';
                 $sTmpEndDate = '';
             }
             echo "\n            if ({$this->_name}SelectName == '{$v}') {\n                document.getElementById('{$this->_name}_start').value = '{$sTmpStartDate}';\n                document.getElementById('{$this->_name}_end').value = '{$sTmpEndDate}';\n            }\n                ";
         }
     }
     echo "\n\n            document.getElementById('{$this->_name}_start').readOnly = !specific;\n            document.getElementById('{$this->_name}_end').readOnly = !specific;\n\n            if (!specific) {\n                document.getElementById('{$this->_name}_start').style.backgroundColor = '#CCCCCC';\n                document.getElementById('{$this->_name}_end').style.backgroundColor = '#CCCCCC';\n                document.getElementById('{$this->_name}_start').tabIndex = null;\n                document.getElementById('{$this->_name}_start_button').tabIndex = null;\n                document.getElementById('{$this->_name}_end').tabIndex = null;\n                document.getElementById('{$this->_name}_end_button').tabIndex = null;\n            } else {\n                document.getElementById('{$this->_name}_start').style.backgroundColor = '#FFFFFF';\n                document.getElementById('{$this->_name}_end').style.backgroundColor = '#FFFFFF';\n                document.getElementById('{$this->_name}_start').tabIndex = {$this->_name}TabIndex;\n                document.getElementById('{$this->_name}_start_button').tabIndex = {$this->_name}TabIndex + 1;\n                document.getElementById('{$this->_name}_end').tabIndex = {$this->_name}TabIndex + 2;\n                document.getElementById('{$this->_name}_end_button').tabIndex = {$this->_name}TabIndex + 3;\n            }\n\n            document.getElementById('{$this->_name}_start_button').readOnly = !specific;\n            document.getElementById('{$this->_name}_end_button').readOnly = !specific;\n            document.getElementById('{$this->_name}_start_button').src = specific ? '" . OX::assetPath() . "/images/icon-calendar.gif' : '" . OX::assetPath() . "/images/icon-calendar-d.gif';\n            document.getElementById('{$this->_name}_end_button').src = specific ? '" . OX::assetPath() . "/images/icon-calendar.gif' : '" . OX::assetPath() . "/images/icon-calendar-d.gif';\n            document.getElementById('{$this->_name}_start_button').style.cursor = specific ? 'auto' : 'default';\n            document.getElementById('{$this->_name}_end_button').style.cursor = specific ? 'auto' : 'default';\n\n            if (!specific && bAutoSubmit) {\n                submitForm();\n            }\n        }\n        {$this->_name}FormChange(0);\n        //-->\n        </script>";
 }
Пример #2
0
 /**
  * A private method to return an array containing the start and end dates
  * of a report in a format that is suitable for display in a worksheet's
  * sub-heading.
  *
  * @access private
  * @return array An array containing the Start Date and End Date, if required.
  */
 function _getDisplayableParametersFromDaySpan()
 {
     $aParams = array();
     if (!is_null($this->_oDaySpan)) {
         global $date_format;
         $aParams[MAX_Plugin_Translation::translate('Start Date', $this->module, $this->package)] = $this->_oDaySpan->getStartDateString($date_format);
         $aParams[MAX_Plugin_Translation::translate('End Date', $this->module, $this->package)] = $this->_oDaySpan->getEndDateString($date_format);
     }
     return $aParams;
 }
Пример #3
0
 /**
  * A method to format the rows of display data to work with the standard "history" style
  * templates.
  *
  * @param array  $aData   A reference to an array of arrays, containing the rows of data.
  * @param object $oCaller The calling object. Expected to have the the class variable
  *                        "statsBreakdown" set.
  */
 function formatRows(&$aData, $oCaller)
 {
     // Re-order the "day of week" breakdown, if required
     if ($oCaller->statsBreakdown == 'dow') {
         $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
         // Re-order when not starting on a Sunday
         for ($counter = 0; $counter < $beginOfWeek; $counter++) {
             $aElement = array_shift($aData);
             $aData[] = $aElement;
         }
     }
     // Format the rows
     if (count($aData) > 0) {
         $i = 1;
         reset($aData);
         foreach (array_keys($aData) as $key) {
             // Is there a set target ratio?
             if (preg_match('/(\\d+\\.\\d*)%/', $aData[$key]['target_ratio'], $aMatches)) {
                 $targetPercent = $aMatches[0];
                 if ($targetPercent < 90) {
                     $aData[$key]['htmlclass'] = 'reddark';
                 } else {
                     if ($targetPercent > 110) {
                         $aData[$key]['htmlclass'] = 'redlight';
                     }
                 }
             } else {
                 if (($aData[$key]['ad_required_impressions'] > 0 || $aData[$key]['placement_required_impressions'] > 0) && $aData[$key]['target_ratio'] == '-') {
                     $aData[$key]['htmlclass'] = 'reddark';
                 }
             }
             // Set the row's "htmlclass" value as being light, or dark
             if (empty($aData[$key]['htmlclass'])) {
                 $aData[$key]['htmlclass'] = $i++ % 2 == 0 ? 'dark' : 'light';
             }
             // Extend the "last" row's "htmlclass" value
             if ($setLast && $i == count($aData)) {
                 $aData[$key]['htmlclass'] .= ' last';
             }
         }
     }
 }
Пример #4
0
 /**
  * A private method that returns the start and end dates
  * that bound the span, based based on a pre-defined 'friendly'
  * value.
  *
  * See the {@link OA_Admin_DaySpan::setSpanPresetValue()} method
  * for the pre-defined values.
  *
  * @param string $presetValue The preset value string.
  * @return array An array of two elements, "start" and "end",
  *               representing the start and end dates of
  *               the span, respectively.
  */
 function _getSpanDates($presetValue)
 {
     switch ($presetValue) {
         case 'today':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'yesterday':
             $oDateStart = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'this_week':
             $oDateStart = new Date(Date_Calc::beginOfWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'last_week':
             $oDateStart = new Date(Date_Calc::beginOfPrevWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd->copy($oDateStart);
             $oDateEnd->addSpan($oSixDaySpan);
             break;
         case 'last_7_days':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             $oDateStart->subtractSpan($oSevenDaySpan);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'this_month_full':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month_remainder':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'next_month':
             $oDateStart = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::endOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'last_month':
             $oDateStart = new Date(Date_Calc::beginOfPrevMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'all_stats':
             $oDateStart = null;
             $oDateEnd = null;
             break;
         case 'specific':
             $startDate = MAX_getStoredValue('startDate', date('Y-m-d'));
             $oDateStart = new Date($startDate);
             $endDate = MAX_getStoredValue('endDate', date('Y-m-d'));
             $oDateEnd = new Date($endDate);
             break;
     }
     $this->_setStartDate($oDateStart);
     $this->_setEndDate($oDateEnd);
     $aDates = array('start' => $oDateStart, 'end' => $oDateEnd);
     return $aDates;
 }
 /**
  * A private method to prepare an array of connections and variable values for the
  * report.
  *
  * @access private
  * @return array An array with the following format:
  *      array(
  *          $trackerId => array(
  *              'connections' => array(
  *                  $connectionId => array(
  *                      'data_intermediate_ad_connection_id' => Integer:   The conversion ID
  *                      'tracker_date_time'                  => Timestamp: The date/time of the conversion
  *                      'tracker_day'                        => String:    The day of the conversion in YYYY-MM-DD format
  *                      'connection_date_time'               => Timestamp: The date/time of the ad impression/click
  *                      'connection_status'                  => Integer:   The status of the connection
  *                      'connection_channel'                 => Integer:   The channel ID of the ad impression/click
  *                      'connection_action'                  => Integer:   If it was an ad impression or click
  *                      'connection_ip_address'              => String:    The IP address of the ad impression/click
  *                      'connection_country'                 => String:    The country of the ad impression/click
  *                      'connection_domain'                  => String:    The domain of the ad impression/click
  *                      'connection_language'                => String:    The language of the ad impression/click
  *                      'connection_os'                      => String:    The operating system of the ad impression/click
  *                      'connection_browser'                 => String:    The browser of the ad impression/click
  *                      'connection_comments'                => String:    Any comments associated with the connection
  *                      'advertiser_id'                      => Integer:   The advertiser ID of the ad impression/click
  *                      'advertiser_name'                    => String:    The name of the advertiser of the ad impression/click
  *                      'placement_id'                       => Integer:   The placement ID of the ad impression/click
  *                      'placement_name'                     => String:    The name of the placement of the ad impression/click
  *                      'ad_id'                              => Integer:   The ad ID of the ad impression/click
  *                      'ad_name'                            => String:    The name of the ad of the ad impression/click
  *                      'ad_alt'                             => String:    The alt. name of the ad of the ad impression/click
  *                      'publisher_id'                       => Integer:   The publisher ID of the ad impression/click
  *                      'publisher_name'                     => String:    The name of the publisher of the ad impression/click
  *                      'zone_id'                            => Integer:   The zone ID of the ad impression/click
  *                      'zone_name'                          => String:    The name of the zone of the ad impression/click
  *                      'tracker_id'                         => Integer:   The tracker ID for the conversion
  *                      'variables'                          => array(
  *                          $trackerVariableId => array(
  *                              tracker_variable_id    => Integer: The tracker variable ID
  *                              tracker_variable_value => Mixed:   The tracker variable value for the conversion
  *                          )
  *                      )
  *                  )
  *              )
  *          )
  *      )
  */
 function _prepareConnections()
 {
     $aConnections = array();
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Prepare the start and end dates for the conversion range
     $oDaySpan = new OA_Admin_DaySpan();
     $oDaySpan->setSpanDays($this->_oDaySpan->oStartDate, $this->_oDaySpan->oEndDate);
     $oDaySpan->toUTC();
     $startDateString = $oDaySpan->getStartDateString('%Y-%m-%d %H:%M:%S');
     $endDateString = $oDaySpan->getEndDateString('%Y-%m-%d %H:%M:%S');
     // Prepare the agency/advertiser/publisher limitations
     $agencyId = $this->_oScope->getAgencyId();
     $advertiserId = $this->_oScope->getAdvertiserId();
     $publisherId = $this->_oScope->getPublisherId();
     // Prepare the query to select the required conversions and variable values
     $query = "\n            SELECT\n                diac.data_intermediate_ad_connection_id AS data_intermediate_ad_connection_id,\n                diac.tracker_date_time AS tracker_date_time,\n                diac.tracker_id AS tracker_id,\n                diac.connection_date_time AS connection_date_time,\n                diac.connection_status AS connection_status,\n                diac.connection_channel AS connection_channel,\n                diac.connection_action AS connection_action,\n                diac.tracker_ip_address AS connection_ip_address,\n                diac.tracker_country AS connection_country,\n                diac.tracker_domain AS connection_domain,\n                diac.tracker_language AS connection_language,\n                diac.tracker_os AS connection_os,\n                diac.tracker_browser AS connection_browser,\n                diac.comments AS connection_comments,\n                z.zoneid AS zone_id,\n                z.zonename AS zone_name,\n                p.affiliateid AS publisher_id,\n                p.name AS publisher_name,\n                a.clientid AS advertiser_id,\n                a.clientname AS advertiser_name,\n                c.campaignid AS placement_id,\n                c.campaignname AS campaign_name,\n                b.bannerid AS ad_id,\n                b.description AS ad_name,\n                b.alt AS ad_alt,\n                diavv.tracker_variable_id AS tracker_variable_id,\n                diavv.value AS tracker_variable_value\n            FROM\n                {$aConf['table']['prefix']}{$aConf['table']['data_intermediate_ad_connection']} AS diac\n            JOIN\n                {$aConf['table']['prefix']}{$aConf['table']['banners']} AS b\n            ON\n                (\n                    diac.ad_id = b.bannerid\n                )\n            JOIN\n                {$aConf['table']['prefix']}{$aConf['table']['campaigns']} AS c\n            ON\n                (\n                    b.campaignid = c.campaignid\n                )\n            JOIN\n                {$aConf['table']['prefix']}{$aConf['table']['clients']} AS a\n            ON\n                (\n                    c.clientid = a.clientid\n                )\n            LEFT JOIN\n                {$aConf['table']['prefix']}{$aConf['table']['zones']} AS z\n            ON\n                (\n                    diac.zone_id = z.zoneid\n                )\n            LEFT JOIN\n                {$aConf['table']['prefix']}{$aConf['table']['affiliates']} AS p\n            ON\n                (\n                    z.affiliateid = p.affiliateid\n                )\n            LEFT JOIN\n                {$aConf['table']['prefix']}{$aConf['table']['data_intermediate_ad_variable_value']} AS diavv\n            ON\n                (\n                    diac.data_intermediate_ad_connection_id = diavv.data_intermediate_ad_connection_id\n                )\n            WHERE\n                diac.tracker_date_time >= " . DBC::makeLiteral($startDateString, 'string') . "\n                AND\n                diac.tracker_date_time <= " . DBC::makeLiteral($endDateString, 'string') . "\n                AND\n                diac.inside_window = 1";
     if ($agencyId) {
         $query .= "\n                AND\n                a.agencyid = " . DBC::makeLiteral($agencyId, 'integer');
     }
     if ($advertiserId) {
         $query .= "\n                AND\n                a.clientid = " . DBC::makeLiteral($advertiserId, 'integer');
     }
     if ($publisherId) {
         $query .= "\n                AND\n                z.affiliateid = " . DBC::makeLiteral($publisherId, 'integer');
     }
     $query .= "\n            ORDER BY\n                tracker_id,\n                data_intermediate_ad_connection_id";
     // Select the conversions in the report
     $rsConversions = DBC::NewRecordSet($query);
     $rsConversions->find();
     while ($rsConversions->fetch()) {
         $aConversion = $rsConversions->toArray();
         $trackerId = $aConversion['tracker_id'];
         $connectionId = $aConversion['data_intermediate_ad_connection_id'];
         // Does this tracker/connection pair exist in the result array already?
         // It might, due to multiple attached variable values...
         if (!isset($aConnections[$trackerId]['connections'][$connectionId])) {
             // It's not set, store the connection details
             $oTrackerDate = new Date($aConversion['tracker_date_time']);
             $oTrackerDate->setTZbyID('UTC');
             $oTrackerDate->convertTZ($this->_oDaySpan->oStartDate->tz);
             $oConnectionDate = new Date($aConversion['connection_date_time']);
             $oConnectionDate->setTZbyID('UTC');
             $oConnectionDate->convertTZ($this->_oDaySpan->oStartDate->tz);
             $aConnections[$trackerId]['connections'][$connectionId] = array('data_intermediate_ad_connection_id' => $connectionId, 'tracker_date_time' => $oTrackerDate->format('%Y-%m-%d %H:%M:%S'), 'tracker_day' => $oTrackerDate->format('%Y-%m-%d'), 'connection_date_time' => $oConnectionDate->format('%Y-%m-%d %H:%M:%S'), 'connection_status' => $aConversion['connection_status'], 'connection_channel' => $aConversion['connection_channel'], 'connection_action' => $aConversion['connection_action'], 'connection_ip_address' => $aConversion['connection_ip_address'], 'connection_country' => $aConversion['connection_country'], 'connection_domain' => $aConversion['connection_domain'], 'connection_language' => $aConversion['connection_language'], 'connection_os' => $aConversion['connection_os'], 'connection_browser' => $aConversion['connection_browser'], 'connection_comments' => $aConversion['connection_comments'], 'advertiser_id' => $aConversion['advertiser_id'], 'advertiser_name' => $aConversion['advertiser_name'], 'placement_id' => $aConversion['placement_id'], 'placement_name' => $aConversion['placement_name'], 'ad_id' => $aConversion['ad_id'], 'ad_name' => $aConversion['ad_name'], 'ad_alt' => $aConversion['ad_alt'], 'publisher_id' => $aConversion['publisher_id'], 'publisher_name' => $aConversion['publisher_name'], 'zone_id' => $aConversion['zone_id'], 'zone_name' => $aConversion['zone_name'], 'tracker_id' => $aConversion['tracker_id']);
         }
         // Store the variable value associated with this connection, if one exists
         $trackerVariableId = $aConversion['tracker_variable_id'];
         if (!empty($trackerVariableId)) {
             $aConnections[$trackerId]['connections'][$connectionId]['variables'][$trackerVariableId] = array('tracker_variable_id' => $trackerVariableId, 'tracker_variable_value' => $aConversion['tracker_variable_value']);
         }
     }
     // Return the connections
     return $aConnections;
 }
 /**
  * A method to test the getDayArray() method.
  */
 function testGetDayArray()
 {
     $oDaySpan = new OA_Admin_DaySpan();
     $oTestStartDate = new Date('2006-09-26');
     $oTestEndDate = new Date('2006-09-26');
     $aExpectedResult = array('2006-09-26');
     $oDaySpan->setSpanDays($oTestStartDate, $oTestEndDate);
     $this->assertEqual($oDaySpan->getDayArray(), $aExpectedResult);
     $oTestStartDate = new Date('2006-09-26');
     $oTestEndDate = new Date('2006-10-03');
     $aExpectedResult = array('2006-09-26', '2006-09-27', '2006-09-28', '2006-09-29', '2006-09-30', '2006-10-01', '2006-10-02', '2006-10-03');
     $oDaySpan->setSpanDays($oTestStartDate, $oTestEndDate);
     $this->assertEqual($oDaySpan->getDayArray(), $aExpectedResult);
 }
 /**
  * A private method to create an OA_Admin_DaySpan object with the campaign's
  * start and end date values.
  *
  * @access private
  * @param array $aCampaignData An array of campaign data.
  * @return OA_Admin_DaySpan The date range of the campaign's activation date and
  *                          expiry date.
  */
 function &_rangeFromCampaign($aCampaignData)
 {
     $oCampaignDaySpan = new OA_Admin_DaySpan();
     $oDate = new Date();
     $oBeginDate = new Date($aCampaignData['campaign_start']);
     $oEndDate = new Date($aCampaignData['campaign_end']);
     $oBeginDate->setTzByID('UTC');
     $oEndDate->setTzByID('UTC');
     $oBeginDate->convertTZ($oDate->tz);
     $oEndDate->convertTZ($oDate->tz);
     $oCampaignDaySpan->setSpanDays($oBeginDate, $oEndDate);
     return $oCampaignDaySpan;
 }
Пример #8
0
    $session['prefs']['GLOBALS']['period_preset'] = $periodPreset;
} else {
    $period_start = htmlspecialchars(MAX_getStoredValue('period_start', date('Y-m-d')));
    if (!strstr($period_start, '-')) {
        $period_start = date('Y-m-d', strtotime($period_start));
        MAX_changeStoredValue('period_start', $period_start);
    }
    $period_end = htmlspecialchars(MAX_getStoredValue('period_end', date('Y-m-d')));
    if (!strstr($period_end, '-')) {
        $period_end = date('Y-m-d', strtotime($period_end));
        MAX_changeStoredValue('period_end', $period_end);
    }
    if (!empty($period_start) && !empty($period_end)) {
        $oStartDate = new Date($period_start);
        $oEndDate = new Date($period_end);
        $oDaySpan = new OA_Admin_DaySpan();
        $oDaySpan->setSpanDays($oStartDate, $oEndDate);
        $periodFromDates = $oDaySpan->getPreset();
        $_REQUEST['period_preset'] = $periodFromDates;
        $session['prefs']['GLOBALS']['period_preset'] = $periodFromDates;
    } else {
        $_REQUEST['period_preset'] = $periodPreset;
        $session['prefs']['GLOBALS']['period_preset'] = $periodPreset;
    }
}
phpAds_registerGlobal('breakdown', 'entity', 'agency_id', 'advertiser_id', 'clientid', 'campaignid', 'placement_id', 'ad_id', 'bannerid', 'publisher_id', 'affiliateid', 'zone_id', 'zoneid', 'start_date', 'end_date', 'sort', 'asc', 'show', 'expand', 'day', 'plugin', 'peroid_preset', 'tempPeriodPreset', 'GraphFile', 'graphFilter', 'graphFields', 'listorder', 'orderdirection');
$day = htmlspecialchars($day);
$listorder = htmlspecialchars($listorder);
$orderdirection = htmlspecialchars($orderdirection);
if (!($orderdirection == 'up' || $orderdirection == 'down')) {
    if (stristr($orderdirection, 'down')) {