/** * Load the form. * * @return void */ private function loadForm() { // create form $this->frm = new BackendForm('filter', BackendModel::createURLForAction(), 'get'); // add fields $this->frm->addText('name', $this->filter['name']); // manually parse fields $this->frm->parse($this->tpl); }
/** * Parse the datagrid */ protected function parse() { parent::parse(); $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false); $this->tpl->assign('godUser', BackendAuthentication::getUser()->isGod()); // assign to template $this->tpl->assign('items', $this->items); $this->tpl->assign('settings', $this->settings); $this->form->parse($this->tpl); }
/** * Parse the form */ protected function parse() { parent::parse(); // assign to template $this->tpl->assign('item', $this->record); $this->tpl->assign('settings', $this->settings); $this->tpl->assign('godUser', BackendAuthentication::getUser()->isGod()); $this->settingsForm->parse($this->tpl); // assign message if address was not be geocoded if ($this->record['lat'] == null || $this->record['lng'] == null) { $this->tpl->assign('errorMessage', BL::err('AddressCouldNotBeGeocoded')); } }
/** * Parse the form * * @return void */ private function parse() { // show options if ($this->needsAkismet) { $this->tpl->assign('needsAkismet', true); } if ($this->needsGoogleMaps) { $this->tpl->assign('needsGoogleMaps', true); } // parse the form $this->frm->parse($this->tpl); // parse the warnings $this->parseWarnings(); }
/** * Load the form. * * @return void */ private function loadForm() { // create form $this->frm = new BackendForm('filter', BackendModel::createURLForAction(), 'get'); // values for dropdowns $status = BackendProfilesModel::getStatusForDropDown(); $groups = BackendProfilesModel::getGroups(); // add fields $this->frm->addText('email', $this->filter['email']); $this->frm->addDropdown('status', $status, $this->filter['status']); $this->frm->getField('status')->setDefaultElement(''); // add a group filter if wa have groups if (!empty($groups)) { $this->frm->addDropdown('group', $groups, $this->filter['group']); $this->frm->getField('group')->setDefaultElement(''); } // manually parse fields $this->frm->parse($this->tpl); }
/** * Parse the form * * @return void */ private function parse() { // parse the form $this->frm->parse($this->tpl); }
/** * Parse the form * * @return void */ protected function parse() { $this->frm->parse($this->tpl); }
/** * Parse the form */ protected function parse() { parent::parse(); $this->frm->parse($this->tpl); }
/** * Form for periodpicker * * @return void * @param BackendTemplate $tpl The template to parse the period picker in. * @param int $startTimestamp The start timestamp for the google call. * @param int $endTimestamp The end timestamp for the google call. * @param array[optional] $parameters The extra GET parameters to set on redirect. */ public static function parsePeriodPicker(BackendTemplate $tpl, $startTimestamp, $endTimestamp, $parameters = array()) { // redefine $startTimestamp = (int) $startTimestamp; $endTimestamp = (int) $endTimestamp; // assign $tpl->assign('startTimestamp', $startTimestamp); $tpl->assign('endTimestamp', $endTimestamp); // create form $frm = new BackendForm('periodPickerForm'); // create datepickers $frm->addDate('start_date', $startTimestamp, 'range', mktime(0, 0, 0, 1, 1, 2005), time(), 'noFocus'); $frm->addDate('end_date', $endTimestamp, 'range', mktime(0, 0, 0, 1, 1, 2005), time(), 'noFocus'); // submitted if ($frm->isSubmitted()) { // show the form $tpl->assign('showForm', true); // cleanup fields $frm->cleanupFields(); // shorten fields $txtStartDate = $frm->getField('start_date'); $txtEndDate = $frm->getField('end_date'); // required fields $txtStartDate->isFilled(BL::err('StartDateIsInvalid')); $txtEndDate->isFilled(BL::err('EndDateIsInvalid')); // dates within valid range if ($txtStartDate->isFilled() && $txtEndDate->isFilled()) { // valid dates if ($txtStartDate->isValid(BL::err('StartDateIsInvalid')) && $txtEndDate->isValid(BL::err('EndDateIsInvalid'))) { // get timestamps $newStartDate = BackendModel::getUTCTimestamp($txtStartDate); $newEndDate = BackendModel::getUTCTimestamp($txtEndDate); // init valid $valid = true; // startdate cannot be before 2005 (earliest valid google startdate) if ($newStartDate < mktime(0, 0, 0, 1, 1, 2005)) { $valid = false; } elseif ($newEndDate > time()) { $valid = false; } elseif ($newStartDate > $newEndDate) { $valid = false; } // invalid range if (!$valid) { $txtStartDate->setError(BL::err('DateRangeIsInvalid')); } } } // valid if ($frm->isCorrect()) { // parameters $parameters['start_timestamp'] = $newStartDate; $parameters['end_timestamp'] = $newEndDate; // build redirect string $redirect = html_entity_decode(BackendModel::createURLForAction(null, null, null, $parameters)); // redirect SpoonHTTP::redirect($redirect); } } // parse $frm->parse($tpl); // we only allow live data fetching when the end date is today, no point in fetching and older range because it will never change if ($endTimestamp == mktime(0, 0, 0, date('n'), date('j'), date('Y'))) { // url of current action $liveDataUrl = BackendModel::createURLForAction('loading') . '&redirect_action=' . Spoon::get('url')->getAction(); // page id set if (isset($_GET['page_id']) && $_GET['page_id'] != '') { $liveDataUrl .= '&page_id=' . (int) $_GET['page_id']; } // page path set if (isset($_GET['page_path']) && $_GET['page_path'] != '') { $liveDataUrl .= '&page_path=' . (string) $_GET['page_path']; } // assign $tpl->assign('liveDataURL', $liveDataUrl); } }
/** * Parse all datagrids */ protected function parse() { parent::parse(); // parse the datagrid for the drafts $this->tpl->assign('dgDrafts', $this->dgDrafts->getNumResults() != 0 ? $this->dgDrafts->getContent() : false); // parse the datagrid for all blogposts $this->tpl->assign('dgPosts', $this->dgPosts->getNumResults() != 0 ? $this->dgPosts->getContent() : false); // parse the datagrid for the most recent blogposts $this->tpl->assign('dgRecent', is_object($this->dgRecent) && $this->dgRecent->getNumResults() != 0 ? $this->dgRecent->getContent() : false); // get categories $categories = BackendBlogModel::getCategories(true); // multiple categories? if (count($categories) > 1) { // create form $frm = new BackendForm('filter', null, 'get', false); // create element $frm->addDropdown('category', $categories, $this->categoryId); $frm->getField('category')->setDefaultElement(''); // parse the form $frm->parse($this->tpl); } // parse category if (!empty($this->category)) { $this->tpl->assign('filterCategory', $this->category); } }
/** * Parse the form */ protected function parse() { parent::parse(); // parse the form $this->frm->parse($this->tpl); }
/** * Parse */ protected function parse() { parent::parse(); if (!isset($this->sessionToken)) { // show the link to the google account authentication form $this->tpl->assign('NoSessionToken', true); $this->tpl->assign('Wizard', true); // build the link to the google account authentication form $redirectUrl = SITE_URL . '/' . (strpos($this->URL->getQueryString(), '?') === false ? $this->URL->getQueryString() : substr($this->URL->getQueryString(), 0, strpos($this->URL->getQueryString(), '?'))); $googleAccountAuthenticationForm = sprintf(BackendAnalyticsModel::GOOGLE_ACCOUNT_AUTHENTICATION_URL, urlencode($redirectUrl), urlencode(BackendAnalyticsModel::GOOGLE_ACCOUNT_AUTHENTICATION_SCOPE)); // parse the link to the google account authentication form $this->tpl->assign('googleAccountAuthenticationForm', $googleAccountAuthenticationForm); } // session token is present but no table id if (isset($this->sessionToken) && isset($this->profiles) && !isset($this->tableId)) { // show all possible accounts with their profiles $this->tpl->assign('NoTableId', true); $this->tpl->assign('Wizard', true); $accounts = array(); // no profiles or not authorized if (!empty($this->profiles) && $this->profiles !== 'UNAUTHORIZED') { $accounts[''][0] = BL::msg('ChooseWebsiteProfile'); // prepare accounts array foreach ((array) $this->profiles as $profile) { $accounts[$profile['accountName']][$profile['tableId']] = $profile['title']; } // there are accounts if (!empty($accounts)) { // sort accounts uksort($accounts, array('BackendAnalyticsSettings', 'sortAccounts')); // create form $frm = new BackendForm('linkProfile', BackendModel::createURLForAction(), 'get'); $frm->addDropdown('table_id', $accounts); $frm->parse($this->tpl); if ($frm->isSubmitted()) { if ($frm->getField('table_id')->getValue() == '0') { $this->tpl->assign('ddmTableIdError', BL::err('FieldIsRequired')); } } // parse accounts $this->tpl->assign('accounts', true); } } } // everything is fine if (isset($this->sessionToken) && isset($this->tableId) && isset($this->accountName)) { // show the linked account $this->tpl->assign('EverythingIsPresent', true); // show the title of the linked account and profile $this->tpl->assign('accountName', $this->accountName); $this->tpl->assign('profileTitle', $this->profileTitle); } }