Exemplo n.º 1
0
 public function beforeValidate()
 {
     if ($this->isNewRecord && $this->keyword === null) {
         $this->keyword = AdminHelper::generateUrlStr($this->alias, $this, 'keyword');
     }
     return parent::beforeValidate();
 }
Exemplo n.º 2
0
 public static function session_footer()
 {
     if (array_key_exists("fc_mode", $_SESSION)) {
         $mode = $_SESSION["fc_mode"];
         if ($mode == AdminHelper::MODE_ADMIN) {
             AdminHelper::admin_footer();
         } elseif ($mode == AdminHelper::MODE_PREVIEW) {
             AdminHelper::preview_footer();
         }
     }
 }
Exemplo n.º 3
0
function checkLogin()
{
    if (isset($_POST['email_address']) && isset($_POST['password'])) {
        $login_details = AdminHelper::doLogin($_POST['email_address'], $_POST['password']);
        if ($login_details !== false) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Exemplo n.º 4
0
 public static function addHistoryLink($link = false, $modelName = false, $ignoreRequestForModelName = false)
 {
     if (\Session::has('adminHistoryLinks')) {
         $links = \Session::get('adminHistoryLinks');
     } else {
         $links = array();
     }
     if (!$link) {
         $url = explode('?', $_SERVER["REQUEST_URI"]);
         $link = array_shift($url) . Tools::getGets();
     }
     if (!$modelName) {
         $modelName = \Request::segment(2);
     }
     $linkSegments = explode("/", $link);
     $action = isset($linkSegments[3]) ? $linkSegments[3] : false;
     $addLink = isset($linkSegments[4]) && $linkSegments[4] == "new" ? true : false;
     $tempLinks = $links;
     if (count($links)) {
         $delete = false;
         foreach ($links as $index => $cLink) {
             // If ModelName and Action already exist in history, it means we're going back
             // therefore delete all history links AFTER the current history link
             // and replace current history with the newly modified one
             if ($cLink['modelConfigName'] == $modelName && $cLink['action'] == $action) {
                 $delete = true;
                 // Skip this iteration because this is the link we're going back to
                 continue;
             }
             // Delete all links after the one we're going back to
             if ($delete) {
                 unset($tempLinks[$index]);
             }
         }
         if ($delete) {
             \Session::put('adminHistoryLinks', $tempLinks);
             // There is no need to insert the current link because it already exists
             // so just return
             return;
         }
     }
     $modelConfig = AdminHelper::modelExists($modelName);
     if ($ignoreRequestForModelName) {
         $returnModelName = $modelConfig ? $modelConfig->hrName : $modelName;
     } else {
         $returnModelName = $modelConfig ? count(\Request::segments()) > 2 && \Request::segment(3) == 'edit' ? $modelConfig->hrName : $modelConfig->hrNamePlural : $modelName;
     }
     $links[] = array('link' => $link, 'action' => $action, 'addLink' => $addLink, 'modelConfigName' => $modelConfig ? $modelConfig->name : $modelName, 'modelName' => $returnModelName, 'modelIcon' => $modelConfig && $modelConfig->faIcon ? $modelConfig->faIcon : 'fa-circle');
     \Session::put('adminHistoryLinks', $links);
 }
Exemplo n.º 5
0
 /**
  * Generate the filtered url string.
  */
 public function beforeSave($event)
 {
     $owner = $this->getOwner();
     $id = !$owner->isNewRecord ? $owner->primaryKey : null;
     foreach (Yii::app()->languageManager->languages as $l => $lang) {
         if ($l === Yii::app()->sourceLanguage) {
             $suffix = '';
             $language = null;
         } else {
             $suffix = '_' . $l;
             $language = $l;
         }
         $owner->{$this->attribute . $suffix} = AdminHelper::generateUrlStr($owner->{$this->sourceAttribute . $suffix}, $owner, $this->attribute, $id, $language);
     }
 }
Exemplo n.º 6
0
 public function beforeSave()
 {
     $id = !$this->isNewRecord ? $this->primaryKey : null;
     foreach (Yii::app()->languageManager->languages as $l => $lang) {
         if ($l === Yii::app()->sourceLanguage) {
             $suffix = '';
             $language = null;
         } else {
             $suffix = '_' . $l;
             $language = $l;
         }
         $this->{'title_url' . $suffix} = AdminHelper::generateUrlStr($this->{'title' . $suffix}, $this, 'title_url', $id, $language);
     }
     return parent::beforeSave();
 }
Exemplo n.º 7
0
 /**
  * Returns script filename by URL
  *
  * @param string $site Site ID.
  * @param string $url URL.
  * @return string|null
  */
 public static function getRealPath($site, $url)
 {
     $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
     $url = str_replace('\\', '/', $url);
     $url = \CHTTP::urnEncode($url);
     $uri = new \Bitrix\Main\Web\Uri($url);
     $path = \CHTTP::urnDecode($uri->getPath());
     if (substr($path, -1, 1) == '/') {
         $path .= 'index.php';
     }
     $file = new \Bitrix\Main\IO\File($docRoot . $path);
     if ($file->isExists()) {
         return substr($file->getPath(), strlen($docRoot));
     }
     if ($rewriteRules = AdminHelper::getRewriteRules($site)) {
         $pathQuery = \CHTTP::urnDecode($uri->getPathQuery());
         foreach ($rewriteRules as &$item) {
             if (preg_match($item['CONDITION'], $pathQuery)) {
                 $url = empty($item['PATH']) && !empty($item['RULE']) ? preg_replace($item['CONDITION'], $item['RULE'], $pathQuery) : $item['PATH'];
                 $url = \CHTTP::urnEncode($url);
                 $uri = new \Bitrix\Main\Web\Uri($url);
                 $path = \CHTTP::urnDecode($uri->getPath());
                 $file = new \Bitrix\Main\IO\File($docRoot . $path);
                 if ($file->isExists()) {
                     $pathTmp = str_replace('.', '', strtolower(ltrim($path, '/\\')));
                     $pathTmp7 = substr($pathTmp, 0, 7);
                     if ($pathTmp7 == 'upload/' || $pathTmp7 == 'bitrix/') {
                         continue;
                     }
                     if ($file->getExtension() != 'php') {
                         continue;
                     }
                     return substr($file->getPath(), strlen($docRoot));
                 }
             }
         }
     }
     return null;
 }
Exemplo n.º 8
0
 /**
  * Generates the TabularInputWidget and the javascript that drives the blocs.
  */
 public function run()
 {
     // Preparing variables.
     $layouts = array();
     $layoutSelect = array();
     $afterAddItem = '';
     $beforeAddItem = '';
     $afterInit = '';
     $sortableStart = '';
     $sortableStop = '';
     $beforeDeleteItem = '';
     $afterDeleteItem = '';
     foreach (Yii::app()->params['blocs'] as $bloc) {
         $modelClassName = 'Bloc' . ucfirst($bloc);
         $newBlocModel = new $modelClassName();
         $newBlocModel->title_anchor = true;
         $newBlocModel->title_page = true;
         $layouts['application.components.blocs.' . $bloc . '.views.admin'] = $newBlocModel;
         $layoutSelect['application.components.blocs.' . $bloc . '.views.admin'] = Yii::t('admin', 'bloc_' . $bloc);
         $afterAddItem .= Yii::app()->cms->blocs[$bloc]->afterAddItem() . "\n";
         $beforeAddItem .= Yii::app()->cms->blocs[$bloc]->beforeAddItem() . "\n";
         $afterInit .= Yii::app()->cms->blocs[$bloc]->afterInit() . "\n";
         $sortableStart .= Yii::app()->cms->blocs[$bloc]->sortableStart() . "\n";
         $sortableStop .= Yii::app()->cms->blocs[$bloc]->sortableStop() . "\n";
         $beforeDeleteItem .= Yii::app()->cms->blocs[$bloc]->beforeDeleteItem() . "\n";
         $afterDeleteItem .= Yii::app()->cms->blocs[$bloc]->afterDeleteItem() . "\n";
     }
     $renderData = array();
     foreach ($this->models as $key => $models) {
         if ($key !== 0) {
             $renderData[$key] = $models;
         }
     }
     // Instanciating widget.
     $this->widget('application.components.widgets.TabularInput.TabularInputWidget', array('id' => $this->id, 'form' => isset($this->form) ? $this->form : null, 'models' => $this->models[0], 'layoutExpression' => "'application.components.blocs.'.lcfirst(mb_substr(get_class(\$model), 4)).'.views.admin'", 'layout' => $layouts, 'layoutSelect' => $layoutSelect, 'itemTitleExpression' => "Yii::t('admin', \$model->tableName())", 'orderAttribute' => 'rank', 'nestedWidgets' => array('{formId}-{itemId}-blocDocumentDocumentForm', '{formId}-{itemId}-blocPeoplePeopleForm', '{formId}-{itemId}-blocCitationCitationForm', '{formId}-{itemId}-blocFeatureFeatureForm'), 'renderData' => $renderData, 'sortable' => array('start' => "js:function(event, ui){\n\t\t\t\t\t" . AdminHelper::tabularInputCkEditorSortableStart() . "\n\t\t\t\t\t" . $sortableStart . "\n\t\t\t\t}", 'stop' => "js:function(event, ui){\n\t\t\t\t\t" . AdminHelper::tabularInputCkEditorSortableStop() . "\n\t\t\t\t\t" . $sortableStop . "\n\t\t\t\t}"), 'beforeDeleteItem' => "function(id, itemId){\n\t\t\t\t" . AdminHelper::tabularInputCkEditorBeforeDeleteItem() . "\n\t\t\t\t" . $beforeDeleteItem . "\n\t\t\t}", 'afterDeleteItem' => "function(id, itemId){\n\t\t\t\t" . $afterDeleteItem . "\n\t\t\t}", 'beforeAddItem' => "function(id, itemId){\n\t\t\t\t" . $beforeAddItem . "\n\t\t\t}", 'afterAddItem' => "function(id, itemId){\n\t\t\t\t" . AdminHelper::tabularInputAfterAddItemDatetimePicker() . "\n\t\t\t\t" . $afterAddItem . "\n\t\t\t}", 'afterInit' => "function(id){\n\t\t\t\t" . $afterInit . "\n\t\t\t}"));
 }
<div class="col-lg-6">

	@foreach ($modelConfig->relatedModels as $relatedModel)
		<?php 
$displayModel = true;
if ($modelConfig->reverseConstrainingModels) {
    foreach ($modelConfig->reverseConstrainingModels as $constraint) {
        if (method_exists($object, $constraint) && $object->{$constraint}->count()) {
            $displayModel = false;
            break;
        }
    }
}
$method = $relatedModel->method;
$relatedModelConfig = AdminHelper::modelExists($relatedModel->name);
$gets = Tools::getGets(array($modelConfig->id => $object->id ? $object->id : "new_gtcms_entry"));
$configInParent = $object->relatedModelConfiguration($relatedModelConfig->name);
GtcmsPremium::setDisplayRelatedModelBasedOnModelKey($configInParent, $object, $displayModel);
?>
		@if ($displayModel)

			<div class="panel panel-default">
				<div class="panel-body">
					<?php 
// --------------- EXCEPTIONS ----------------
$addObject = true;
?>
					@if ($addObject)
						<div class="indexTableHeader">
							<a href="/admin/{{$relatedModelConfig->name}}/add{{$gets}}&addToParent=true" class="btn btn-primary btn-sm addRelatedObject">
								<i class="fa fa-plus-circle"></i> {{$relatedModelConfig->hrName}}
Exemplo n.º 10
0
 public function attributeLabels()
 {
     return AdminHelper::multilangLabels($this, array('id' => '#', 'title_anchor' => 'Inclure dans l’index de contenu', 'title_page' => 'Afficher le titre dans la page', 'title' => 'Titre du bloc', 'user_id' => 'Utilisateur', 'set_id' => 'Galerie', 'nbr_images' => 'Nombre d’images', 'show_as_carrousel' => 'Afficher en tant que carrousel'));
 }
Exemplo n.º 11
0
<?php

// parsing posted data:
if (isset($_POST['docampaignedit'])) {
    // do the actual list add stuffs...
    $edit_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'editcampaign', 'id' => $request_parameters[0], 'title' => $_POST['campaign_title'], 'description' => $_POST['campaign_description']));
    if ($edit_response['status_uid'] == 'element_editcampaign_200') {
        AdminHelper::formSuccess('Success. Edited.', '/');
    } else {
        AdminHelper::formFailure('Error. There was a problem editing your campaign.', '/');
    }
}
$current_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getcampaign', 'id' => $request_parameters[0]));
$cash_admin->page_data['ui_title'] = 'Campaigns: Edit "' . $current_response['payload']['title'] . '"';
$current_campaign = $current_response['payload'];
if (is_array($current_campaign)) {
    $cash_admin->page_data = array_merge($cash_admin->page_data, $current_campaign);
}
$cash_admin->page_data['form_state_action'] = 'docampaignedit';
$cash_admin->page_data['button_text'] = 'Save changes';
$elements_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getelementsforcampaign', 'id' => $request_parameters[0]));
if (is_array($elements_response['payload'])) {
    foreach ($elements_response['payload'] as &$element) {
        if ($element['modification_date'] == 0) {
            $element['formatted_date'] = CASHSystem::formatTimeAgo($element['creation_date']);
        } else {
            $element['formatted_date'] = CASHSystem::formatTimeAgo($element['modification_date']);
        }
    }
    $cash_admin->page_data['elements_for_campaign'] = new ArrayIterator($elements_response['payload']);
}
Exemplo n.º 12
0
 public function attributeLabels()
 {
     return AdminHelper::multilangLabels($this, array('id' => 'ID', 'bloc_feature_id' => 'Bloc Feature', 'image' => 'Image reliée', 'title' => 'Titre de la caractéristique', 'description' => 'Détails de la caractéristique', 'rank' => 'Rank'));
 }
Exemplo n.º 13
0
<?php

// add unique page settings:
$page_title = 'Elements: Main';
$page_tips = 'This is where specific functionalities will be deployed, pages installed, and widgets set up. It is really the heart of the public-facing tools — the other tabs are more aimed at management, lightweight CRM, and fulfillment.';
$page_memu = array('Elements' => array('elements/add/' => array('Add Element', 'plus_alt'), 'elements/view/' => array('Your Elements', 'heart_fill')));
$element_page_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'mostactive', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
if ($element_page_request->response['status_code'] == 200) {
    $page_data['element_mostactive'] = $element_page_request->response['payload'];
} else {
    $page_data['element_mostactive'] = false;
}
$element_page_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'recentlyadded', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
if ($element_page_request->response['status_code'] == 200) {
    $page_data['element_recentlyadded'] = $element_page_request->response['payload'];
} else {
    $page_data['element_recentlyadded'] = false;
}
Exemplo n.º 14
0
 /**
  * Saving related Bloc entry.
  */
 public function afterSave($event)
 {
     $owner = $this->getOwner();
     if ($owner->isNewRecord) {
         $contentBloc = new Bloc();
         if (Yii::app()->languageManager->multilang) {
             $contentBloc->multilang();
         }
         $contentBloc->parent_id = $owner->parent_id;
         $contentBloc->bloc_type = mb_substr($owner->tableName(), 5);
         $contentBloc->bloc_id = $owner->primaryKey;
     } else {
         if (Yii::app()->languageManager->multilang) {
             $contentBloc = Bloc::model()->multilang()->findByAttributes(array('bloc_id' => $owner->primaryKey, 'bloc_type' => mb_substr($owner->tableName(), 5)));
         } else {
             $contentBloc = Bloc::model()->findByAttributes(array('bloc_id' => $owner->primaryKey, 'bloc_type' => mb_substr($owner->tableName(), 5)));
         }
     }
     $contentBloc->rank = $owner->rank;
     $contentBloc->title_anchor = $owner->title_anchor;
     $contentBloc->title_page = $owner->title_page;
     $contentBloc->unique_id = $owner->unique_id;
     $contentBloc->last_modified = date('Y-m-d H:i:s');
     foreach (Yii::app()->languageManager->languages as $l => $fullLanguage) {
         if ($l === Yii::app()->sourceLanguage) {
             $suffix = '';
         } else {
             $suffix = '_' . $l;
         }
         $contentBloc->{'title' . $suffix} = $owner->{'title' . $suffix};
         if ($owner->isNewRecord) {
             $contentBloc->{'title_url' . $suffix} = AdminHelper::generateUrlStr($owner->{'title' . $suffix}, $contentBloc, 'title_url', null, $l);
         } else {
             $contentBloc->{'title_url' . $suffix} = AdminHelper::generateUrlStr($owner->{'title' . $suffix}, $contentBloc, 'title_url', $contentBloc->id, $l);
         }
     }
     $contentBloc->save(false);
 }
Exemplo n.º 15
0
<?php

if (!$request_parameters) {
    header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
$page_request = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getlist', 'list_id' => $request_parameters[0]), 'getlist');
//var_dump($page_request);
if ($page_request['status_uid'] == 'people_getlist_200') {
    $elements_data = AdminHelper::getElementsData();
    $effective_user = AdminHelper::getPersistentData('cash_effective_user');
    if ($page_request['payload']['user_id'] == $effective_user) {
        if (isset($_POST['dodelete']) || isset($_GET['modalconfirm'])) {
            $list_delete_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'deletelist', 'list_id' => $request_parameters[0]));
            if ($list_delete_request->response['status_uid'] == 'people_deletelist_200') {
                header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
            }
        }
        $cash_admin->page_data['title'] = 'People: Delete “' . $page_request->response['payload']['name'] . '”';
    } else {
        header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
    }
} else {
    header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/delete/' . $request_parameters[0]);
}
$cash_admin->setPageContentTemplate('delete_confirm');
Exemplo n.º 16
0
Arquivo: edit.php Projeto: nodots/DIY
		<input type="hidden" name="doelementedit" value="makeitso" />
		<input type="hidden" name="element_type" value="signin" />
		<h3>Element Details</h3>

		<label for="element_name">Name</label><br />
		<input type="text" id="element_name" name="element_name" value="<?php 
echo $page_data['name'];
?>
" /> 

		<div class="row_seperator">.</div>
			<label for="email_list_id">Target Mailing List</label><br />
			<select id="email_list_id" name="email_list_id">
				<option value="0">none</option>
				<?php 
AdminHelper::echoFormOptions('people_lists', $page_data['options']->email_list_id);
?>
			</select>

		<div class="row_seperator">.</div>
		<br />
		<label for="display_title">Display Title (blank for none)</label><br />
		<input type="text" id="display_title" name="display_title" value="<?php 
echo $page_data['options']->display_title;
?>
" />

		<div class="row_seperator">.</div>
		<label for="display_message">Display Message</label><br />
		<input type="text" id="display_message" name="display_message" value="<?php 
echo $page_data['options']->display_message;
Exemplo n.º 17
0
                // turn the rest of the request into the parameters array
                $request_parameters = array_slice($exploded_request, 0 - (sizeof($exploded_request) - $fails_at_level));
            }
        } else {
            define('BASE_PAGENAME', '');
            $include_filename = 'error.php';
        }
    }
} else {
    define('BASE_PAGENAME', 'mainpage');
    $include_filename = 'mainpage.php';
}
// if a login needs doing, do it
$login_message = "Log In";
if (isset($_POST['login'])) {
    $login_details = AdminHelper::doLogin($_POST['address'], $_POST['password']);
    if ($login_details !== false) {
        $admin_primary_cash_request->sessionSet('cash_actual_user', $login_details);
        $admin_primary_cash_request->sessionSet('cash_effective_user', $login_details);
        $admin_primary_cash_request->sessionSet('cash_effective_user_email', $_POST['address']);
        if ($include_filename == 'logout.php') {
            header('Location: ' . ADMIN_WWW_BASE_PATH);
            exit;
        }
    } else {
        $admin_primary_cash_request->sessionClearAll();
        $login_message = "Try Again";
    }
}
// make a few objects to use throughout the pages
$cash_admin = new AdminCore($admin_primary_cash_request->sessionGet('cash_effective_user'));
Exemplo n.º 18
0
 public function attributeLabels()
 {
     return AdminHelper::multilangLabels($this, array('id' => '#', 'title_anchor' => 'Inclure dans l’index de contenu', 'title_page' => 'Afficher le titre dans la page', 'title' => 'Titre du bloc', 'html' => 'Contenu texte'));
 }
Exemplo n.º 19
0
<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'job-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>

	<?php 
echo $form->errorSummary(array_merge(AdminHelper::blocsErrors($blocs), array($model)));
?>
	
	<?php 
foreach (Yii::app()->languageManager->suffixes as $suffix) {
    ?>

		<div class="row">
			<?php 
    echo $form->labelEx($model, 'title' . $suffix);
    ?>
			<?php 
    echo $form->textField($model, 'title' . $suffix, array('size' => 60, 'maxlength' => 255));
    ?>
			<?php 
    echo $form->error($model, 'title' . $suffix);
    ?>
		</div>
	
	<?php 
}
?>
	
	<div class="row">
Exemplo n.º 20
0
<?php

if (isset($_POST['dobatchcontactsadd'])) {
    if (!empty($_POST['element_content'])) {
        $email_array = array_map('trim', explode(",", str_replace(PHP_EOL, ',', $_POST['element_content'])));
        if (count($email_array) > 0) {
            if ($_POST['email_list_id']) {
                $total_added = 0;
                foreach ($email_array as $address) {
                    $add_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'addaddresstolist', 'do_not_verify' => 1, 'address' => $address, 'list_id' => $_POST['email_list_id']));
                    if ($add_request->response['payload']) {
                        $total_added++;
                    }
                }
                $cash_admin->page_data['page_message'] = 'Success. Added ' . $total_added . ' new emails to your list.';
            } else {
                $cash_admin->page_data['page_message'] = 'Please select a list to add contacts to.';
            }
        }
    }
}
$cash_admin->page_data['list_options'] = AdminHelper::echoFormOptions('people_lists', 0, false, true);
$cash_admin->setPageContentTemplate('people_contacts');
Exemplo n.º 21
0
		interfaces soon.
	</span></p>

	<form method="post" action="">
		<input type="hidden" name="doeventedit" value="makeitso" />

		<label for="event_date">Date</label><br />
		<input type="text" id="event_date" name="event_date" value="<? echo date('m/j/Y h:iA T',$current_event['date']); ?>" />

		<div class="row_seperator">.</div>

		<label for="event_venue">Venue</label><br />
		<select id="event_venue" name="event_venue">
			<option value="0" selected="selected">Unknown (Will be listed as 'TBA')</option>
			<?php 
    AdminHelper::echoFormOptions('venues', $current_event['venue_id']);
    ?>
		</select>

		<div class="row_seperator">.</div>
		<label for="event_comment">Comments (Support, CD Release, etc)</label><br />
		<textarea rows="3" id="event_comment" name="event_comment"><?php 
    echo $current_event['comments'];
    ?>
</textarea>

		<div class="row_seperator">.</div>
		<label for="event_purchase_url">Ticket Purchase URL</label><br />
		<input type="text" id="event_purchase_url" name="event_purchase_url" value="<?php 
    echo $current_event['purchase_url'];
    ?>
Exemplo n.º 22
0
<?php

// parsing posted data:
if (isset($_POST['dovenueedit'])) {
    $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'editvenue', 'id' => $request_parameters[0], 'name' => $_POST['venue_name'], 'city' => $_POST['venue_city'], 'region' => $_POST['venue_region'], 'country' => $_POST['venue_country'], 'address1' => $_POST['venue_address1'], 'address2' => $_POST['venue_address2'], 'postalcode' => $_POST['venue_postalcode'], 'url' => $_POST['venue_url'], 'phone' => $_POST['venue_phone']), 'venueeditattempt');
}
$current_venue_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'getvenue', 'venue_id' => $request_parameters[0]), 'getvenue');
$current_venue = $current_venue_response['payload'];
if (is_array($current_venue)) {
    $cash_admin->page_data = array_merge($cash_admin->page_data, $current_venue);
}
$cash_admin->page_data['form_state_action'] = 'dovenueedit';
$cash_admin->page_data['venue_button_text'] = 'Edit the venue';
$cash_admin->page_data['country_options'] = AdminHelper::drawCountryCodeUL($current_venue['country']);
$cash_admin->setPageContentTemplate('calendar_venues_details');
Exemplo n.º 23
0
<?php

$settings = $cash_admin->getUserSettings();
if ($settings['banners'][BASE_PAGENAME]) {
    echo '<div class="introductorybanner"><div class="titlespc"><h2>Calendar</h2>enter your <b>shows</b><br />manage <b>guestlists</b><br />check <b>venue</b> details</div>';
    echo 'Enter all your shows, manage your calendar and your guest lists, and use all of it to feed elements like show listings, tour archives, and even guest list slot giveaways.';
    echo '<div class="closelink"><a href="?hidebanner=true">close <span class="icon x_alt"></span></a></div></div>';
}
?>

<div class="col_oneoftwo">
	<h2>This week at a glance</h2>
	<?php 
echo AdminHelper::simpleULFromResponse($cash_admin->getStoredResponse('events_thisweek'));
?>
</div>
<div class="col_oneoftwo lastcol">
	<h2>Unpublished events</h2>
	<?php 
echo AdminHelper::simpleULFromResponse($cash_admin->getStoredResponse('events_unpublished'));
?>
</div>
Exemplo n.º 24
0
    }
}
// set basic data for the template
$page_menu_details = AdminHelper::getPageMenuDetails();
$cash_admin->page_data['assets_section_menu'] = $page_menu_details['assets_section_menu'];
$cash_admin->page_data['people_section_menu'] = $page_menu_details['people_section_menu'];
$cash_admin->page_data['commerce_section_menu'] = $page_menu_details['commerce_section_menu'];
$cash_admin->page_data['calendar_section_menu'] = $page_menu_details['calendar_section_menu'];
$cash_admin->page_data['ui_title'] = $page_menu_details['page_title'];
// merge in display links for main template
$cash_admin->page_data = array_merge($cash_admin->page_data, $page_menu_details['link_text']);
// global interaction text
$ui_interaction_text = AdminHelper::getUiText();
$cash_admin->page_data = array_merge($cash_admin->page_data, $ui_interaction_text);
// page specifics
$page_components = AdminHelper::getPageComponents();
$cash_admin->page_data['ui_page_tip'] = $page_components['pagetip'];
$cash_admin->page_data['ui_learn_text'] = $page_components['learn'];
if (is_array($page_components['labels'])) {
    foreach ($page_components['labels'] as $key => $val) {
        $cash_admin->page_data['label_' . $key] = $val;
    }
}
if (is_array($page_components['tooltips'])) {
    foreach ($page_components['tooltips'] as $key => $val) {
        $cash_admin->page_data['tooltip_' . $key] = $val;
    }
}
if (is_array($page_components['copy'])) {
    foreach ($page_components['copy'] as $key => $val) {
        $cash_admin->page_data['copy_' . $key] = $val;
Exemplo n.º 25
0
        }
        // format date for viewing
        $event['formatted_date'] = date('d M', $event['date']);
        // format location
        if (strtolower($event['venue_country']) == 'usa' || strtolower($event['venue_country']) == 'canada') {
            $event['event_location'] = $event['venue_city'] . ', ' . $event['venue_region'];
        } else {
            $event['event_location'] = $event['venue_city'] . ', ' . $event['venue_country'];
        }
        if ($event['event_location'] == ', ') {
            $event['event_location'] = '';
        }
    }
}
$thisweek_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'geteventsbetween', 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'cutoff_date_low' => 'now', 'cutoff_date_high' => time() + 60 * 60 * 24 * 7), 'events_thisweek');
$unpublished_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'getevents', 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'visible_event_types' => 'upcoming', 'published_status' => 0), 'events_unpublished');
// banner stuff
$settings = $cash_admin->getUserSettings();
if ($settings['banners'][BASE_PAGENAME]) {
    $cash_admin->page_data['banner_title_content'] = '<h2>Calendar</h2>enter your <b>shows</b><br />manage <b>guestlists</b><br />check <b>venue</b> details';
    $cash_admin->page_data['banner_main_content'] = 'Enter all your shows, manage your calendar and your guest lists, and use all of it to feed elements like show listings, tour archives, and even guest list slot giveaways.';
}
// this week
if (is_array($thisweek_response['payload'])) {
    formatEventOutput($thisweek_response);
    $cash_admin->page_data['events_thisweek'] = new ArrayIterator($thisweek_response['payload']);
}
// unpublished
// most accessed
if (is_array($unpublished_response['payload'])) {
    formatEventOutput($unpublished_response);
Exemplo n.º 26
0
<?php

$blnAuthenticated = AdminHelper::authenticate($_REQUEST["username"], $_REQUEST["password"]);
if ($blnAuthenticated == true) {
    $_SESSION["username"] = stripslashes($_REQUEST["username"]);
    $_SESSION["password"] = stripslashes($_REQUEST["password"]);
    $mode = "loggedin";
} else {
    $mode = "form";
}
Exemplo n.º 27
0
        AdminHelper::formSuccess('Success. Asset added. Feel free to start adding details.', '/assets/edit/' . $add_response['payload']);
    } else {
        AdminHelper::formFailure('Error. Something just didn\'t work right.', '/assets/add/');
    }
}
$cash_admin->page_data['form_state_action'] = 'doassetadd';
$cash_admin->page_data['asset_button_text'] = 'Save changes';
// create type options with current selected:
if (isset($request_parameters[0])) {
    $add_type = $request_parameters[0];
    $cash_admin->page_data['type'] = $add_type;
    $cash_admin->page_data['ui_title'] = 'Assets: Add a ' . $add_type;
    if ($add_type == 'file') {
        // connection options markup:
        $cash_admin->page_data['connection_options'] = '<option value="0" selected="selected">None (Normal http:// link)</option>';
        $cash_admin->page_data['connection_options'] .= AdminHelper::echoConnectionsOptions('assets', 0, true);
        $cash_admin->page_data['show_location'] = true;
    }
} else {
    $add_type = 'file';
    $cash_admin->page_data['ui_title'] = 'Assets: Add an asset';
}
$type_options = array('file' => 'File', 'playlist' => 'Playlist', 'release' => 'Release');
$cash_admin->page_data['type_options_markup'] = '';
foreach ($type_options as $type => $value) {
    if ($add_type == $type) {
        $selected = ' selected="selected"';
    } else {
        $selected = '';
    }
    $cash_admin->page_data['type_options_markup'] .= '<option value="' . $type . '"' . $selected . '>' . $value . '</option>';
Exemplo n.º 28
0
<?php

// add unique page settings:
$page_title = 'People: Main';
$page_tips = '';
$page_memu = array('People' => array('people/contacts/' => array('Contacts', 'user'), 'people/lists/' => array('Lists', 'list'), 'people/social/' => array('Social', 'chat')));
$current_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getlistsforuser', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'getlistsforuser');
Exemplo n.º 29
0
$eval_response = $cash_admin->requestAndStore(array('cash_request_type' => 'asset', 'cash_action' => 'getanalytics', 'analtyics_type' => 'mostaccessed', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'asset_mostaccessed');
// recently added assets
$eval_response = $cash_admin->requestAndStore(array('cash_request_type' => 'asset', 'cash_action' => 'getanalytics', 'analtyics_type' => 'recentlyadded', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'asset_recentlyadded');
// next week of events
$cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'geteventsbetween', 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'cutoff_date_low' => 'now', 'cutoff_date_high' => time() + 60 * 60 * 24 * 7), 'events_thisweek');
// most active elements
$eval_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'mostactive', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'element_mostactive');
// recently added elements
$eval_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'recentlyadded', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'element_recentlyadded');
// get all elements
$eval_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getelementsforuser', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'element_allelements');
$lists_response = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getlistsforuser', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
$lists_array = array();
$lists_count = 1;
foreach ($lists_response->response['payload'] as $list) {
    $analytics_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getanalytics', 'analtyics_type' => 'listmembership', 'list_id' => $list['id'], 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
    $lists_array[] = array('id' => $list['id'], 'name' => $list['name'], 'total' => $analytics_request->response['payload']['active'], 'lastweek' => $analytics_request->response['payload']['last_week']);
    unset($analytics_request);
    $lists_count++;
    if ($lists_count > 3) {
        break;
    }
}
// count the active elements
if ($cash_admin->getStoredResponse('element_mostactive', true)) {
    $cash_admin->storeData(count($cash_admin->getStoredResponse('element_mostactive', true)), 'element_active_count');
}
// if active elements are found, subtract them from the total to get inactive elements
if ($cash_admin->getStoredData('element_active_count')) {
    $cash_admin->storeData(count($cash_admin->getStoredResponse('element_allelements', true)) - $cash_admin->getStoredData('element_active_count'), 'element_inactive_count');
}
Exemplo n.º 30
-1
 public static function handleRedirectReturn($data = false)
 {
     if (!isset($data['key'])) {
         return 'There was an error. (general) Please try again.';
     } else {
         require_once CASH_PLATFORM_ROOT . '/lib/mandrill/Mandrill.php';
         $m = new Mandrill($data['key']);
         $user_info = $m->getUserInfo();
         $username = $user_info['username'];
         // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
         // calls would only happen in the admin. If this changes we can f**k around with it later.
         $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
         $result = $new_connection->setSettings($username . ' (Mandrill)', 'com.mandrillapp', array('key' => $data['key']));
         if (!$result) {
             return 'There was an error. (adding the connection) Please try again.';
         }
         // set up webhooks
         $api_credentials = CASHSystem::getAPICredentials();
         $webhook_api_url = CASH_API_URL . '/verbose/people/processwebhook/origin/com.mandrillapp/api_key/' . $api_credentials['api_key'];
         //$m->webhooksDelete($webhook_api_url); // remove duplicate webhooks
         //$m->webhooksAdd($webhook_api_url,array('send','hard_bounce','soft_bounce','open','click','spam','unsub','reject')); // add it, all events
         $m->call('webhooks/add', array("url" => $webhook_api_url, "events" => array('hard_bounce', 'soft_bounce', 'open', 'click', 'spam', 'unsub', 'reject')));
         if (isset($data['return_result_directly'])) {
             return $result;
         } else {
             if ($result) {
                 AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
             } else {
                 AdminHelper::formFailure('Error. Something just didn\'t work right.');
             }
         }
     }
 }