Example #1
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $modelC = new Campaigns('search');
     $modelC->unsetAttributes();
     // clear any default values
     if (isset($_GET[get_class($modelC)])) {
         $modelC->attributes = $_GET[get_class($modelC)];
     }
     $this->userData = Users::model()->findByPk($id);
     $list = null;
     switch ($this->userData->role) {
         case Users::ROLE_USER:
             $only_active = false;
             if (isset($_GET[get_class($modelC)])) {
                 $modelC->attributes = $_GET[get_class($modelC)];
                 if (isset($_GET[get_class($modelC)]['is_active']) && $_GET[get_class($modelC)]['is_active'] == 1) {
                     $only_active = true;
                 }
             }
             $list = $modelC->searchForUser($this->userData->id, $only_active);
             break;
         case Users::ROLE_PLATFORM:
             $model = new Platforms('search');
             $model->user_id = $this->userData->id;
             $list = $model->search();
             break;
         case Users::ROLE_WEBMASTER:
             Offers::disableDefaultScope();
             $status = Yii::app()->request->getParam('status', -1);
             $list = OffersUsers::model()->findByUserId($this->userData->id, true, $status === '' ? -1 : $status);
             break;
     }
     $this->render('view', array('model' => $this->loadModel($id), 'modelC' => $modelC, 'list' => $list));
 }
 /**
  * Возвращает объект кампании по переданному идентификатору
  *
  * @return Campaigns
  */
 private function getCampaign()
 {
     if (!isset($this->args['campaign_id'])) {
         return null;
     }
     return Campaigns::model()->findByPk($this->args['campaign_id']);
 }
 public function index()
 {
     //Caching
     //$this->output->cache(1);
     $camp = new Campaigns();
     $camp->debug($_REQUEST);
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $p['offer_name'] = $_REQUEST['offer_name'];
         $p['exp_date'] = $_REQUEST['exp_date'];
         $p['preview_url'] = $_REQUEST['preview_url'];
         $p['offer_url'] = $_REQUEST['offer_url'];
         $p['description'] = $_REQUEST['description'];
         $p['protocol'] = $_REQUEST['protocol'];
         $p['status'] = $_REQUEST['status'];
         $p['advertiser_id'] = $_REQUEST['advertiser_id'];
         $camp->campaignCreate($p);
     }
     $this->load->view('create_campaign_view.php');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($id, Requests\CampaignRequest $request)
 {
     $template = Campaigns::findorFail($id);
     $template->update($request->all());
     return redirect('campaigns/' . $id . '');
 }
Example #5
0
<?php

die("We haven't finished the campaign code yet - please come back later (and bring some beer)");
switch ($type) {
    case 'all':
        // All campaigns.
        $data = Campaigns::getAllCampaigns();
        break;
}
$app->render('campaigns.html', array('data' => $data));
Example #6
0
$budget_cost = array("25000", "50000", "90000");
$actual_cost = array("23500", "45000", "80000");
$num_sent = array("2000", "2500", "3000");
$clo_date = array('2003-1-2', '2004-2-3', '2005-4-12');
$expected_response_count = array("2500", "7500", "5000");
$expected_sales_count = array("25000", "50000", "90000");
$expected_roi = array("23", "45", "82");
$actual_response_count = array("250", "750", "1500");
$actual_sales_count = array("1250", "5200", "2390");
$actual_roi = array("21", "14", "12");
$sponsor = array("Finace", "Marketing", "Sales");
$targetsize = array("210000", "13390", "187424");
$targetaudience = array("Managers", "CEOs", "Rookies");
//$expected_response = Array(null,null,null);
for ($i = 0; $i < count($campaign_name_array); $i++) {
    $campaign = new Campaigns();
    $campaign_name = $campaign_name_array[$i];
    $campaign->column_fields["campaignname"] = $campaign_name;
    $campaign->column_fields["campaigntype"] = $campaign_type_array[$i];
    $campaign->column_fields["campaignstatus"] = $campaign_status_array[$i];
    $campaign->column_fields["numsent"] = $num_sent[$i];
    $campaign->column_fields["expectedrevenue"] = $expected_revenue[$i];
    $campaign->column_fields["budgetcost"] = $budget_cost[$i];
    $campaign->column_fields["actualcost"] = $actual_cost[$i];
    $campaign->column_fields["closingdate"] = $clo_date[$i];
    $campaign->column_fields["expectedresponse"] = $expected_response[$i];
    $campaign->column_fields["assigned_user_id"] = $assigned_user_id;
    $campaign->column_fields["expectedresponsecount"] = $expected_response_count[$i];
    $campaign->column_fields["expectedsalescount"] = $expected_sales_count[$i];
    $campaign->column_fields["expectedroi"] = $expected_roi[$i];
    $campaign->column_fields["actualresponsecount"] = $actual_response_count[$i];
Example #7
0
 * All Rights Reserved.
 ********************************************************************************/
require_once 'modules/Campaigns/Campaigns.php';
require_once 'Smarty_setup.php';
require_once "data/Tracker.php";
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
require_once 'include/database/Postgres8.php';
global $app_strings, $mod_strings, $current_language;
$current_module_strings = return_module_language($current_language, 'Campaigns');
global $currentModule, $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$focus = new Campaigns();
// Initialize sort by fields
$focus->initSortbyField('Campaigns');
// END
$category = getParentTab();
$smarty = new vtigerCRM_Smarty();
$other_text = array();
$url_string = '';
// assigning http url string
if (!$_SESSION['lvs'][$currentModule]) {
    unset($_SESSION['lvs']);
    $modObj = new ListViewSession();
    $modObj->sorder = $sorder;
    $modObj->sortby = $order_by;
    $_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
}
Example #8
0
 function updateAction()
 {
     $model = new Campaign();
     if (isset($_POST['country_id'])) {
         $_POST['country_id'] = implode(',', $_POST['country_id']);
     }
     // check if this is an attachment campaign.  if so, we don't want to validate the urls or fulfillment_id if it isnot presesnt
     $attach = false;
     if (isset($_POST['attach']) && $_POST['attach']) {
         $attach = true;
         $_POST['url'] = $_POST['order_url'] = $_POST['return_url'] = 'attach';
         if (!strlen($_POST['fulfillment_id'])) {
             $_POST['fulfillment_id'] = 0;
         }
     } else {
         $_POST['attach'] = 0;
     }
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['ajax']) && $_POST['ajax'] == 'categorys-form') {
         $model->fillFromArray($_POST, FALSE);
         $model->user_id_updated = $this->user->user_id;
         $model->updated = 'NOW():sql';
         $model->model_uset_id = $this->user->user_id;
         $fulfillment_change = AF::get($_POST, 'fulfillment_change');
         Campaigns::fulfillmentRelationship($model->campaign_id, $model->fulfillment_id, $fulfillment_change);
         if ($model->restrictions()->save()) {
             Message::echoJsonSuccess(__('campaign_updated'));
         } else {
             Message::echoJsonError(__('campaign_no_updated'));
         }
         die;
     }
     $id = AF::get($this->params, 'id', FALSE);
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     if (!$model->restrictions()->cache()->findByPk($id)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $model->country_id = explode(',', $model->country_id);
     Assets::js('jquery.form');
     $this->addToPageTitle('Update campaign');
     //array_unshift($fulfillments, array('fulfillment_id'=>0, 'alias'=>__('none')));
     // Is this used still?
     $ccomboModel = new CCombo();
     $ccomboModel->campaign_id = $model->campaign_id;
     $isCombo = $ccomboModel->checkRelationship();
     $countries = Country::model()->cache()->findAllInArray();
     $profiles = Profile::model()->cache()->findAllInArray();
     // prepend dry run gateway
     array_unshift($profiles, array('profile_id' => 0, 'profile_name' => 'DRY RUN GATEWAY'));
     $fulfillments = Fulfillment::model()->cache()->findAllInArray();
     $currencies = $model->getCountOrders() > 0 ? array() : Currency::model()->cache()->findAllInArray();
     $domains = Domain::model()->cache()->findAllInArray();
     $this->render('update', array('model' => $model, 'countries' => $countries, 'profiles' => $profiles, 'currencies' => $currencies, 'fulfillments' => $fulfillments, 'isCombo' => $isCombo, 'domains' => $domains));
 }
Example #9
0
 public function addCampaign()
 {
     $campaign = new Campaigns();
     $campaign->setCampaignName($this->form_values['campaign_name']);
     $campaign->setDateFrom(App_Tools_Time::now());
     $campaign->setDateTo(App_Tools_Time::now());
     $campaign->setCatchUpDays($this->form_values['catch_up_days']);
     $campaign_type_id = $this->_em->find('CampaignTypes', $this->form_values['campaign_type_id']);
     $campaign->setCampaignType($campaign_type_id);
     $campaign->setIsClosed('0');
     $created_by = $this->_em->find('Users', $this->_user_id);
     $campaign->setCreatedBy($created_by);
     $campaign->setCreatedDate(App_Tools_Time::now());
     $campaign->setModifiedBy($created_by);
     $campaign->setModifiedDate(App_Tools_Time::now());
     $this->_em->persist($campaign);
     $this->_em->flush();
     $last_id = $campaign->getPkId();
     $campaign_id = $this->_em->find('Campaigns', $last_id);
     foreach ($this->form_values['item_id'] as $item_id) {
         $campaign_ips = new CampaignItemPackSizes();
         $campaign_ips->setCampaign($campaign_id);
         $item_id_ips = $this->_em->find('ItemPackSizes', $item_id);
         $campaign_ips->setItemPackSize($item_id_ips);
         $campaign_ips->setCreatedBy($created_by);
         $campaign_ips->setCreatedDate(App_Tools_Time::now());
         $campaign_ips->setModifiedBy($created_by);
         $campaign_ips->setModifiedDate(App_Tools_Time::now());
         $this->_em->persist($campaign_ips);
     }
     $this->_em->flush();
     //$district_ids = explode(',', $this->form_values['district_ids']);
     //App_Controller_Functions::pr($this->form_values['districts']);
     $created_by = $this->_em->find('Users', $this->_user_id);
     foreach ($this->form_values['districts'] as $district_id) {
         $campaign_d = new CampaignDistricts();
         $campaign_d->setCampaign($campaign_id);
         $district_location_id = $this->_em->find('Locations', $district_id);
         $campaign_d->setDistrict($district_location_id);
         $campaign_d->setCreatedBy($created_by);
         $campaign_d->setCreatedDate(App_Tools_Time::now());
         $campaign_d->setModifiedBy($created_by);
         $campaign_d->setModifiedDate(App_Tools_Time::now());
         $this->_em->persist($campaign_d);
     }
     $this->_em->flush();
     return $last_id;
 }
Example #10
0
 /**
  * Возвращает значение колонки для гео-таргетинга новости
  *
  * @param Campaigns $campaign
  * @return string
  */
 protected function getCampaignGeoTargeting(Campaigns $campaign)
 {
     $geoTargeting = $campaign->getExceptedCities();
     return $geoTargeting ? 'Исключить ' . $geoTargeting : 'Показывать всем';
 }
Example #11
0
 * All Rights Reserved.
 ********************************************************************************/
require_once 'modules/Campaigns/Campaigns.php';
require_once 'Smarty_setup.php';
require_once "data/Tracker.php";
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
require_once 'include/database/Postgres8.php';
global $app_strings, $mod_strings, $current_language;
$current_module_strings = return_module_language($current_language, 'Campaigns');
global $currentModule, $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$focus = new Campaigns();
// Initialize sort by fields
$focus->initSortbyField('Campaigns');
// END
$category = getParentTab();
$smarty = new vtigerCRM_Smarty();
$other_text = array();
$url_string = '';
// assigning http url string
if (!$_SESSION['lvs'][$currentModule]) {
    unset($_SESSION['lvs']);
    $modObj = new ListViewSession();
    $modObj->sorder = $sorder;
    $modObj->sortby = $order_by;
    $_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
}
Example #12
0
    /**
     * Run - called by outside cron
     */
    public static function Run()
    {
        // add here your code...
        // Class::Method();
        $perform_actions = false;
        // update last time running
        $sql = 'SELECT
					cron_type,
					cron_run_last_time,
					cron_run_period,
					cron_run_period_value,
					CASE
						WHEN cron_run_last_time = \'0000-00-00 00:00:00\' THEN \'999\'
						WHEN cron_run_period = \'minute\' THEN TIMESTAMPDIFF(MINUTE, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
						ELSE TIMESTAMPDIFF(HOUR, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
					END as time_diff										
				FROM ' . TABLE_SETTINGS;
        $result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        if ($result['cron_type'] == 'batch') {
            $perform_actions = true;
        } else {
            if ($result['cron_type'] == 'non-batch' && $result['time_diff'] > $result['cron_run_period_value']) {
                $perform_actions = true;
            } else {
                $perform_actions = false;
            }
        }
        if ($perform_actions) {
            // update Feeds
            RSSFeed::UpdateFeeds();
            if (self::$PROJECT == 'ShoppingCart') {
                // close expired discount campaigns
                Campaigns::UpdateStatus();
                // remove expired orders
                Orders::RemoveExpired();
            } else {
                if (self::$PROJECT == 'HotelSite') {
                    // close expired discount campaigns
                    Campaigns::UpdateStatus();
                    // close expired coupons
                    Coupons::UpdateStatus();
                    // remove expired 'Preparing' bookings
                    Bookings::RemoveExpired();
                } else {
                    if (self::$PROJECT == 'BusinnessDirectory') {
                        // close expired lisitngs
                        Listings::UpdateStatus();
                        // remove old inquiries
                        Inquiries::RemoveOld();
                    } else {
                        if (self::$PROJECT == 'MedicalAppointment') {
                            // remove expired appointments
                            Appointments::RemoveExpired();
                            // send reminders for patient and doctor
                            Appointments::SendReminders();
                        } else {
                            if (self::$PROJECT == 'MicroBlog') {
                                // close expired polls
                                Pools::UpdateStatus();
                            }
                        }
                    }
                }
            }
            // update last time running
            $sql = 'UPDATE ' . TABLE_SETTINGS . ' SET cron_run_last_time = \'' . date('Y-m-d H:i:s') . '\'';
            database_void_query($sql);
        }
    }
Example #13
0
 function cloneAction()
 {
     if (isset($_POST['clone'])) {
         $model = new Campaigns();
         $campaigns = $model->getCampaigns();
         AF::setJsonHeaders('json');
         echo json_encode(array('campaigns' => $campaigns));
         die;
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         $campaign_id = AF::get($_POST, 'campaign_id', 0);
         $campprod_ids = AF::get($_POST, 'campship_id', 0);
         if (!$campprod_ids && !$campaign_id) {
             Message::echoJsonError(__('campship_id_not_found'));
         }
         $campprods = explode(',', $campprod_ids);
         $message = array();
         $newIDs = array();
         $isMany = count($campprods) > 1 ? true : false;
         $isThisCampaign = true;
         foreach ($campprods as $id) {
             $model = new CampaignShipping();
             if (!$model->findByPk($id)) {
                 if ($isMany) {
                     continue;
                 }
                 Message::echoJsonError(__('campship_not_found'));
             }
             if ($model->campaign_id != $campaign_id) {
                 $model->campaign_id = $campaign_id;
                 $isThisCampaign = false;
             }
             if (!$model->cloneModel()) {
                 if ($isMany) {
                     continue;
                 }
                 Message::echoJsonError($model->errors2string);
             }
             $newID = $newIDs[] = $model->getPkValue();
             $message[] = __('campship_cloned') . ' <a href="' . $this->controller . '/view/campaign_id=' . $campaign_id . '">' . __('view_campaign') . ' (ID: ' . $newID . ')</a><br>';
             unset($model);
         }
         if (!$message) {
             Message::echoJsonError(__('campship_not_cloned'));
         }
         $message = implode($message);
         $newIDs = implode(',', $newIDs);
         $v = array('message' => $message);
         if ($isThisCampaign) {
             $v['newid'] = $newIDs;
         }
         Message::echoJsonSuccess($v);
     }
 }
Example #14
0
 /**
  * Draw page text
  */
 public function DrawText()
 {
     global $objLogin;
     $objGallery = new GalleryAlbums();
     $objContactUs = ContactUs::Instance();
     $replace_needles = 1;
     $module_page = false;
     if (!count($this->page)) {
         return false;
     }
     // dont show this page if it was expired
     if (!$objLogin->IsLoggedInAsAdmin() && $this->page['finish_publishing'] != '0000-00-00' && date('Y-m-d') > $this->page['finish_publishing']) {
         draw_important_message(_PAGE_EXPIRED);
         return false;
     }
     if ($this->page['content_type'] == 'article' && isset($this->page['page_text'])) {
         $page_text = decode_text($this->page['page_text'], false);
         echo '<div class="pages_contents">';
         if (preg_match('/{module:gallery}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:gallery}/i', $objGallery->DrawGallery(false), $page_text, 1);
         }
         if (preg_match_all('/{module:album=(.*?)}/i', $page_text, $matches)) {
             $module_page = true;
             if (is_array($matches[1])) {
                 foreach ($matches[1] as $key => $val) {
                     if (strtolower($val) != 'code') {
                         $val = @preg_replace('/[^A-Za-z0-9:]/i', '', $val);
                         $page_text = @preg_replace('/{module:album=' . $val . '}/i', $objGallery->DrawAlbum($val, false), $page_text, 1);
                     }
                 }
             }
         }
         if (self::$PROJECT == 'MedicalAppointment') {
             if (preg_match('/{module:about_us}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:about_us}/i', Clinic::DrawAboutUs(false), $page_text, 1);
             }
         }
         if (self::$PROJECT == 'HotelSite') {
             if (preg_match('/{module:about_us}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:about_us}/i', Hotels::DrawAboutUs(false), $page_text, 1);
             }
             if (preg_match('/{module:rooms}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:rooms}/i', Rooms::DrawRoomsInfo(false), $page_text, 1);
             }
             if (preg_match('/{module:testimonials}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:testimonials}/i', Testimonials::DrawTestimonails(false), $page_text, 1);
             }
         }
         if (preg_match('/{module:contact_us}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:contact_us}/i', $objContactUs->DrawContactUsForm(false), $page_text, 1);
         }
         if (preg_match('/{module:faq}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:faq}/i', FaqCategories::DrawFaqList(false), $page_text, 1);
         }
         if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
             $page_text = stripslashes($page_text);
         }
         if ($this->page['is_home']) {
             if (self::$PROJECT == 'HotelSite') {
                 Campaigns::DrawCampaignBanner('standard');
                 Campaigns::DrawCampaignBanner('global');
             }
         }
         //echo $page_text;
         //echo "<hr>";
         // draw all needed blocks for Home page
         if ($this->page['is_home']) {
             if (self::$PROJECT == 'BusinessDirectory') {
                 if (ModulesSettings::Get('listings', 'show_categories_home_block') == 'yes') {
                     Categories::DrawHomePageBlock();
                 }
             } else {
                 if (self::$PROJECT == 'ShoppingCart') {
                     if (ModulesSettings::Get('products_catalog', 'is_active') == 'yes') {
                         Campaigns::DrawCampaignBanner();
                         if (ModulesSettings::Get('products_catalog', 'show_featured_block') == 'home page') {
                             Products::DrawFeaturedBlock('home');
                         }
                         if (ModulesSettings::Get('products_catalog', 'show_new_products_block') == 'home page') {
                             Products::DrawNewProductsBlock();
                         }
                         Categories::DrawHomePageBlock();
                     }
                 }
             }
         }
         // draw comments form
         if (!$this->page['is_home'] && !$module_page) {
             if (Modules::IsModuleInstalled('comments')) {
                 if (ModulesSettings::Get('comments', 'comments_allow') == 'yes' && $this->page['comments_allowed']) {
                     $objComments = new Comments();
                     $objComments->DrawArticleComments($this->page['id']);
                 }
             }
         }
         echo '</div>';
     } else {
         if ($this->page['content_type'] == 'link' && isset($this->page['link_url'])) {
             $link_url = decode_text($this->page['link_url']);
             echo '<div class="pages_contents">';
             echo '<a href="' . $link_url . '">' . $link_url . '</a>';
             echo '</div>';
         }
     }
 }
Example #15
0
 public function isActive()
 {
     if ($this->is_active && !$this->is_deleted && $this->isGoing() && Campaigns::model()->checkIsActive($this->campaign_id, false, false)) {
         return true;
     }
     return false;
 }
Example #16
0
 public function __construct($path)
 {
     try {
         $this->configuration = new ZdpArrayObject(parse_ini_file('zdp.ini'));
         try {
             $this->database = new PDO('mysql:host=' . $this->configuration['dbhost'] . ';dbname=' . $this->configuration['dbname'] . ';port=3306', $this->configuration['dbuser'], $this->configuration['dbpass']);
         } catch (PDOException $err) {
             $this->database = new ZdpArrayObject(['error' => 'Unable to connect to the database.']);
         }
         //Determines if any restrictions on classes are set and, if so, retrieves them from the config then combines them with the declared classes of the environment,
         //otherwise, grabs only the declared environment classes. NOTE: ALL classes that are preloaded before route is loaded WILL BE RESTRICTED. There is NO exception
         //to this until a 'restriction-exception' option can be added to the INI.
         if ($this->configuration->keyExists('restrictions') && trim($this->configuration['restrictions']) != '') {
             $this->configuration['restrictions'] = new ZdpArrayObject(array_merge(explode(',', $this->configuration['restrictions']), get_declared_classes()));
         } else {
             $this->configuration['restrictions'] = new ZdpArrayObject(get_declared_classes());
         }
         $this->classStack = new ZdpArrayObject();
         //Creates a new ArrayObject (using the ZdpArrayObject extension object) and explodes the path into it.
         $workingPath = new ZdpArrayObject(explode('/', $path));
         //Determines if the first and last elements are empty space and, if so, shifts and pops them off of the stack.
         //Determines if the first element matches the UUID definition.
         if (preg_match('/.{8}\\-.{4}\\-.{4}\\-.{4}\\-.{8}/', $workingPath[0]) === 1 || Marathons::IsMarathon(new ZdpArrayObject(['Name' => $workingPath[0]]), $this->configuration, null, null, $this->database)['result']['marathon'][0]['is_marathon'] > 0) {
             $this->marathon = $workingPath[0];
             $workingPath->shift();
         }
         if (preg_match('/.{8}\\-.{4}\\-.{4}\\-.{4}\\-.{8}/', $workingPath[0]) === 1 || Campaigns::IsCampaign(new ZdpArrayObject(['Name' => $workingPath[0]]), $this->configuration, null, null, $this->database)['result']['campaign'][0]['is_campaign'] > 0) {
             $this->campaign = $workingPath[0];
             $workingPath->shift();
         }
         if (preg_match('/.{8}\\-.{4}\\-.{4}\\-.{4}\\-.{8}/', $workingPath[0]) === 1) {
             $this->key = $workingPath[0];
             $workingPath->shift();
         }
         $this->validateIdentity();
         //Creates a class and method comparer to see if a class has been found and iterates over the ZdpArrayObject. The current class is populated once a new class is found and added to the object's class stack.
         $currentClass = '';
         $currentMethod = '';
         //This is a work around to determine if the first element is a class and implements page
         //(pages should NEVER be called after the first class. This is undefined behavior and will only work if 'render' is explicitly provided as the method being called)
         //and if its next element is NOT the render method.
         $implements = new ZdpArrayObject(class_implements($workingPath[0]));
         if (class_exists($workingPath[0]) && $implements->contains('Page') && ($workingPath->count() > 1 && $workingPath[1] != 'render' && !method_exists($workingPath[0], $workingPath[1]) || $workingPath->count() === 1)) {
             $workingPath->splice(1, 0, ['render']);
         }
         foreach ($workingPath as $component) {
             //Determines if the class exists and is not the same as the current class and, if so, creates a new class container and sets the class comparer, else, it determines if a class doesn't exist
             //with the component's name and that the class name is set and begins handling potential method code.
             if (class_exists($component) && $currentClass !== $component && !$this->configuration['restrictions']->contains($component)) {
                 $this->classStack[$component] = new ZdpArrayObject();
                 $currentClass = $component;
             } else {
                 if (!class_exists($component) && trim($currentClass) != '' && trim($component) != '') {
                     //Determines if a method exists in the class with the name of component and, if so, creates a new method container, else, determines if the current method string is set and begins handling
                     //potential parameter code.
                     if (method_exists($currentClass, $component)) {
                         $this->classStack[$currentClass][$component] = new ZdpArrayObject();
                         $currentMethod = $component;
                     } else {
                         if (trim($currentMethod) != '' && trim($component) != '') {
                             //Determines if the parameter contains an equals sign and, if so, splits on the sign and adds a parameter with the name of index 0 and the value of index 1, else, adds a parameter with the
                             //name of component and the value of true.
                             if (strpos($component, '=') !== false) {
                                 $holder = explode('=', $component);
                                 //Determines the type of the parameter and sets it to the proper type.
                                 if (ctype_digit($holder[1])) {
                                     $holder[1] = intval($holder[1]);
                                 } else {
                                     if (is_numeric($holder[1])) {
                                         $holder[1] = floatval($holder[1]);
                                     } else {
                                         if (strtoupper($holder[1]) == 'TRUE') {
                                             $holder[1] = true;
                                         } else {
                                             if (strtoupper($holder[1]) == 'FALSE') {
                                                 $holder[1] = false;
                                             }
                                         }
                                     }
                                 }
                                 $this->classStack[$currentClass][$currentMethod][$holder[0]] = $holder[1];
                             } else {
                                 $this->classStack[$currentClass][$currentMethod]->push($component);
                             }
                         } else {
                             //Do something when a method isn't found.
                         }
                     }
                 } else {
                     //Do something when a path isn't found.
                 }
             }
         }
     } catch (ApiException $err) {
         $this->error = $err;
     }
 }
 public function getModifiedBy()
 {
     $this->__load();
     return parent::getModifiedBy();
 }
Example #18
0
 /**
  * Устанавливает кеш кампании
  *
  * @param Campaigns $campaign
  * @return bool
  */
 public function setCampaignCache(Campaigns $campaign)
 {
     return $this->redis()->hMset($this->getCampaignCacheKey($campaign->id), array_merge(array_diff_key($campaign->getAttributes(), array('track_js' => null)), array('date_end' => strtotime($campaign->date_end . '23:59:59'))));
 }