public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $badge = new UploadField('Badge', _t('ScoutGroup.BADGE', 'Badge'));
     $badge->setFolderName('group/badge');
     $badge->setRightTitle(_t('ScoutGroup.BADGE_HELP', 'The badge/logo/emblem of the Group'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Info', $badge);
     $necker = new UploadField('Necker', _t('ScoutGroup.NECKER', 'Necker'));
     $necker->setFolderName('group/necker');
     $necker->setRightTitle(_t('ScoutGroup.NECKER_HELP', 'The neckerchief the Group'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Info', $necker);
     $fields->addFieldToTab('Root.Info', new TextField('NeckerDescription', _t('ScoutGroup.NECKERDESCRIPTION', 'Neckerchief Description')));
     $fields->addFieldToTab('Root.Social', new TextField('TwitterUser', _t('ScoutGroup.TWITTERUSER', 'Twitter User')));
     $fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('ScoutGroup.FACEBOOKPAGE', 'Facebook Page')));
     $fields->addFieldToTab('Root.Social', new TextField('GooglePage', _t('ScoutGroup.GOOGLEPAGE', 'Google Page')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address1', _t('ScoutGroup.ADDRESS1', 'Address 1')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address2', _t('ScoutGroup.ADDRESS2', 'Address 2')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address3', _t('ScoutGroup.ADDRESS3', 'Address 3')));
     $fields->addFieldToTab('Root.Contact', new TextField('Town', _t('ScoutGroup.TOWN', 'Town')));
     $fields->addFieldToTab('Root.Contact', new TextField('Postcode', _t('ScoutGroup.POSTCODE', 'Post Code')));
     $fields->addFieldToTab('Root.Contact', new TextField('Phone', _t('ScoutGroup.PHONE', 'Phone #')));
     $fields->addFieldToTab('Root.Contact', new TextField('Email', _t('ScoutGroup.EMAIL', 'Email Address')));
     $fields->addFieldToTab('Root.Contact', new TextField('CharityNumber', _t('ScoutGroup.CHARITYNUMBER', 'CharityNumber')));
     $sectionGridConfig = new GridFieldConfig_RecordEditor();
     $sectionGridConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $sectionGrid = new GridField('Sections', 'Sections', $this->Sections(), $sectionGridConfig);
     $fields->addFieldToTab('Root.Sections', $sectionGrid);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function validate($validator)
 {
     // If the field is empty then don't return an invalidation message
     if (!trim(implode("", $this->value))) {
         return true;
     }
     $i = 0;
     if ($this->value) {
         foreach ($this->value as $part) {
             if (!$part || !(strlen($part) == 4) || !preg_match("/([0-9]{4})/", $part)) {
                 switch ($i) {
                     case 0:
                         $number = _t('CreditCardField.FIRST', 'first');
                         break;
                     case 1:
                         $number = _t('CreditCardField.SECOND', 'second');
                         break;
                     case 2:
                         $number = _t('CreditCardField.THIRD', 'third');
                         break;
                     case 3:
                         $number = _t('CreditCardField.FOURTH', 'fourth');
                         break;
                 }
                 $validator->validationError($this->name, _t('Form.VALIDATIONCREDITNUMBER', "Please ensure you have entered the {number} credit card number correctly", array('number' => $number)), "validation", false);
                 return false;
             }
             $i++;
         }
     }
 }
 /**
  *
  */
 public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null)
 {
     $o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null;
     // Set place hierarchy
     if ($vs_hierarchy = $pa_item['settings']['placeSplitter_placeHierarchy']) {
         $vn_hierarchy_id = caGetListItemID('place_hierarchies', $vs_hierarchy);
     } else {
         // Default to first place hierarchy
         $t_list = new ca_lists();
         $va_hierarchy_ids = $t_list->getItemsForList('place_hierarchies', array('idsOnly' => true));
         $vn_hierarchy_id = array_shift($va_hierarchy_ids);
     }
     if (!$vn_hierarchy_id) {
         if ($o_log) {
             $o_log->logError(_t('[placeSplitterRefinery] No place hierarchies are defined'));
         }
         return array();
     }
     $pa_options['hierarchyID'] = $vn_hierarchy_id;
     $t_place = new ca_places();
     if ($t_place->load(array('parent_id' => null, 'hierarchy_id' => $vn_hierarchy_id))) {
         $pa_options['defaultParentID'] = $t_place->getPrimaryKey();
     }
     return caGenericImportSplitter('placeSplitter', 'place', 'ca_places', $this, $pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options);
 }
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->opo_browse = new OccurrenceBrowse($this->opo_result_context->getSearchExpression(), 'providence');
     $this->opa_views = array('list' => _t('list'), 'editable' => _t('editable'));
     $this->opa_sorts = array_merge(array('ca_occurrence_labels.name' => _t('name'), 'ca_occurrences.idno_sort' => _t('idno')), $this->opa_sorts);
 }
 /**
  * Returns a readonly span containing the correct value.
  *
  * @param array $properties
  *
  * @return string
  */
 public function Field($properties = array())
 {
     $source = ArrayLib::flatten($this->getSource());
     $values = $this->getValueArray();
     // Get selected values
     $mapped = array();
     foreach ($values as $value) {
         if (isset($source[$value])) {
             $mapped[] = $source[$value];
         }
     }
     // Don't check if string arguments are matching against the source,
     // as they might be generated HTML diff views instead of the actual values
     if ($this->value && is_string($this->value) && empty($mapped)) {
         $mapped = array(trim($this->value));
         $values = array();
     }
     if ($mapped) {
         $attrValue = implode(', ', array_values($mapped));
         $attrValue = Convert::raw2xml($attrValue);
         $inputValue = implode(', ', array_values($values));
     } else {
         $attrValue = '<i>(' . _t('FormField.NONE', 'none') . ')</i>';
         $inputValue = '';
     }
     $properties = array_merge($properties, array('AttrValue' => DBField::create_field('HTMLFragment', $attrValue), 'InputValue' => $inputValue));
     return parent::Field($properties);
 }
Example #6
0
 /**
  * @param string $sortField - Field to sort the blocks on. If this is set, it will also make the
  * 	blocks sortable in the CMS (requires SortableGridField module!)
  * @param array $allowedBlocks - a set of allowed class names, optionally mapped to titles
  * @param int $itemsPerPage - How many items per page should show up
  */
 public function __construct($sortField = null, $allowedBlocks = null, $itemsPerPage = null)
 {
     parent::__construct($itemsPerPage);
     // setup a bulk manager for block management
     $bulkManager = new GridFieldBulkManager();
     // remove the default actions
     $toRemove = array('bulkedit', 'bulkEdit', 'delete', 'unlink', 'unLink');
     $validActions = array_keys($bulkManager->getConfig('actions'));
     foreach ($toRemove as $key) {
         if (in_array($key, $validActions)) {
             $bulkManager->removeBulkAction($key);
         }
     }
     // add the actions in desired order
     $bulkManager->addBulkAction('publish', _t('PageBlock.PUBLISH', 'Publish'))->addBulkAction('unpublish', _t('PageBlock.UNPUBLISH', 'Unpublish'))->addBulkAction('bulkedit', _t('PageBlock.EDIT', 'Edit'), 'GridFieldBulkActionEditHandler', array('icon' => 'pencil'))->addBulkAction('versionedunlink', _t('PageBlock.UNLINK', 'Unlink'), 'GridFieldBulkActionVersionedUnlinkHandler', array('icon' => 'chain--minus'))->addBulkAction('versioneddelete', _t('PageBlock.DELETE', 'Delete'), 'GridFieldBulkActionVersionedDeleteHandler', array('isDestructive' => true, 'icon' => 'decline'));
     if ($sortField && class_exists('GridFieldOrderableRows')) {
         $this->addComponent(new GridFieldOrderableRows($sortField));
     }
     // remove the delete action, since unlinking is not required
     $this->removeComponent($this->getComponentByType('GridFieldDeleteAction'));
     // remove the search field since it doesn't make sense (cannot add existing, unless "stealing" from another page)
     $this->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $this->addComponent(new GridFieldAddExistingSearchButton('buttons-before-right'));
     $this->addComponent(new GridFieldAddNewMultiClass(), 'GridFieldToolbarHeader');
     $this->addComponent($bulkManager);
     $this->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => _t('Block.TITLE', 'Title'), 'i18n_singular_name' => _t('Block.TYPE', 'Type'), 'PublishedStatus' => _t('Block.STATUS', 'Status')));
     $this->setAllowedBlocks($allowedBlocks);
 }
 public function FieldHolder()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('eventmanagement/javascript/EventInvitationField.js');
     $link = $this->createTag('a', array('id' => 'event-do-invite', 'href' => $this->Link('invite')), _t('EventManagement.INVITEPEOPLETOEVENT', 'Invite People To Event'));
     return $this->createTag('div', array('id' => $this->id(), 'href' => $this->Link('FieldHolder')), "<p>{$link}</p>" . $this->table->FieldHolder());
 }
 public function onBeforeWrite()
 {
     if ($this->owner->BaseClass == "Discussion" && $this->owner->ID == 0) {
         $discussion = Discussion::get()->byID($this->owner->ParentID);
         $discussion_author = $discussion->Author();
         $holder = $discussion->Parent();
         $author = Member::get()->byID($this->owner->AuthorID);
         // Get our default email from address
         if (DiscussionHolder::config()->send_emails_from) {
             $from = DiscussionHolder::config()->send_email_from;
         } else {
             $from = Email::config()->admin_email;
         }
         // Vars for the emails
         $vars = array("Title" => $discussion->Title, "Author" => $author, "Comment" => $this->owner->Comment, 'Link' => Controller::join_links($holder->Link("view"), $discussion->ID, "#comments-holder"));
         // Send email to discussion owner
         if ($discussion_author && $discussion_author->Email && $discussion_author->RecieveCommentEmails && $discussion_author->ID != $this->owner->AuthorID) {
             $subject = _t("Discussions.NewCreatedReplySubject", "{Nickname} replied to your discussion", null, array("Nickname" => $author->Nickname));
             $email = new Email($from, $discussion_author->Email, $subject);
             $email->setTemplate('NewCreatedReplyEmail');
             $email->populateTemplate($vars);
             $email->send();
         }
         // Send to anyone who liked this, if they want notifications
         foreach ($discussion->LikedBy() as $liked) {
             if ($liked->RecieveLikedReplyEmails && $liked->Email && $liked->ID != $author->ID) {
                 $subject = _t("Discussions.NewLikedReplySubject", "{Nickname} replied to your liked discussion", null, array("Nickname" => $author->Nickname));
                 $email = new Email($from, $liked->Email, $subject);
                 $email->setTemplate('NewLikedReplyEmail');
                 $email->populateTemplate($vars);
                 $email->send();
             }
         }
     }
 }
 /**
  * @param array $data
  * @return SS_HTTPResponse|void
  */
 function doChangePassword(array $data)
 {
     try {
         $token = Session::get('AutoLoginHash');
         $member = $this->password_manager->changePassword($token, @$data['NewPassword1'], @$data['NewPassword2']);
         Session::clear('AutoLoginHash');
         $back_url = isset($_REQUEST['BackURL']) ? $_REQUEST['BackURL'] : '/';
         return OpenStackIdCommon::loginMember($member, $back_url);
     } catch (InvalidResetPasswordTokenException $ex1) {
         Session::clear('AutoLoginHash');
         Controller::curr()->redirect('login');
     } catch (EmptyPasswordException $ex2) {
         $this->clearMessage();
         $this->sessionMessage(_t('Member.EMPTYNEWPASSWORD', "The new password can't be empty, please try again"), "bad");
         Controller::curr()->redirectBack();
     } catch (PasswordMismatchException $ex3) {
         $this->clearMessage();
         $this->sessionMessage(_t('Member.ERRORNEWPASSWORD', "You have entered your new password differently, try again"), "bad");
         Controller::curr()->redirectBack();
     } catch (InvalidPasswordException $ex4) {
         $this->clearMessage();
         $this->sessionMessage(sprintf(_t('Member.INVALIDNEWPASSWORD', "We couldn't accept that password: %s"), nl2br("\n" . $ex4->getMessage())), "bad");
         Controller::curr()->redirectBack();
     }
 }
Example #10
0
 /**
  *
  * Constructor for HiEngine
  *
  * Sets up the stream protocol handler
  */
 public function __construct()
 {
     $streams = stream_get_wrappers();
     if (!in_array('hi', $streams)) {
         stream_wrapper_register("hi", "HiEngineParser") or die(_t("Failed to register HiEngine stream protocol"));
     }
 }
    public function updateSettingsFields(FieldList $fields)
    {
        //removing view settings
        $fields->removeByName("CanViewType");
        $fields->removeByName("ViewerGroups");
        //adding view settings displaying the custom hard coded view settings
        $groups = $this->owner->DictatedViewerGroups();
        $groupsStr = '';
        if ($groups) {
            foreach ($groups as $g) {
                $groupsStr .= "{$g->Title}, ";
            }
            $groupsStr = rtrim($groupsStr, ', ');
        } else {
            $groupsStr = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
        }
        $fields->addFieldToTab('Root', LiteralField::create('CanViewTypeExpl', '
<div class="field fieldgroup fieldgroup">
	<label class="left">' . _t('SiteTree.ACCESSHEADER', "Who can view this page?") . '</label>
	<div class="middleColumn fieldgroup ">
		<p>
			<em>' . $groupsStr . '</em>
		</p>

	</div>
</div>
			'), 'CanEditType');
    }
 /**
  * Process the Cheque payment method
  */
 public function processPayment($data, $form)
 {
     $this->Status = 'Pending';
     $this->Message = '<p class="warningMessage">' . _t('ChequePayment.MESSAGE', 'Payment accepted via Cheque. Please note : products will not be shipped until payment has been received.') . '</p>';
     $this->write();
     return new Payment_Success();
 }
 /**
  * Adds PublishDate to CMS Form.
  * @param $fields
  */
 function updateCMSFields(FieldList $fields)
 {
     $datefield = DatetimeField::create('PublishDate', _t('CMSPublishableDataExtension.PUBLISH_DATE', 'Publish date'));
     $datefield->getDateField()->setConfig('showcalendar', 1);
     // $datefield->setConfig('setLocale', en_US);
     $fields->addFieldToTab("Root.Main", $datefield, 'Content');
 }
Example #14
0
 protected function genCustomInputSubmitText($aInput)
 {
     return '<div class="bx-form-right-line-aligned">
                 <a href="' . BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password') . '">' . _t("_sys_txt_forgot_pasword") . '</a>
             </div>
             <div class="clear_both"></div>';
 }
 /**
  * Place the print button in a <p> tag below the field
  *
  * @param GridField
  *
  * @return array
  */
 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'print', _t('TableListField.Print', 'Print'), 'print', null);
     $button->setAttribute('data-icon', 'grid_print');
     $button->addExtraClass('gridfield-button-print');
     return array($this->targetFragment => '<p class="grid-print-button">' . $button->Field() . '</p>');
 }
Example #16
0
 function activate($sTemplate)
 {
     $aTemplate = BxDolModuleQuery::getInstance()->getModuleByName($sTemplate);
     if (empty($aTemplate) || !is_array($aTemplate)) {
         return array('code' => 1, 'message' => _t('_adm_err_operation_failed'));
     }
     $aTemplates = array();
     $iTemplates = $this->oDb->getTemplatesBy(array('type' => 'active'), $aTemplates);
     if ($iTemplates == 1 && $aTemplates[0]['name'] == $sTemplate) {
         return array('code' => 1, 'message' => _t('_adm_dsg_err_last_active'));
     }
     $sTemplateDefault = getParam('template');
     if ($aTemplate['uri'] == $sTemplateDefault) {
         return array('code' => 2, 'message' => _t('_adm_dsg_err_deactivate_default'));
     }
     $oInstallerUtils = BxDolStudioInstallerUtils::getInstance();
     $aResult = (int) $aTemplate['enabled'] == 0 ? $oInstallerUtils->perform($aTemplate['path'], 'enable') : $oInstallerUtils->perform($aTemplate['path'], 'disable');
     if ($aResult['code'] != 0) {
         return $aResult;
     }
     $oTemplate = BxDolStudioTemplate::getInstance();
     $aResult = array('code' => 0, 'message' => _t('_adm_scs_operation_done'));
     if ((int) $aTemplate['enabled'] == 0) {
         $aResult['content'] = $oTemplate->parseHtmlByName('page_content_2_col.html', array('page_menu_code' => $this->getPageMenu(), 'page_main_code' => $this->getPageCode()));
     } else {
         $aResult['content'] = "";
     }
     return $aResult;
 }
    public function __construct($controller, $name, FieldList $fields, FieldList $actions, $validator = null)
    {
        parent::__construct($controller, $name, $fields, $actions, $validator);
        Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-form/jquery.form.js');
        $name = $this->FormName();
        $action = $this->FormAction();
        $loading = _t('BootstrapAjaxForm.LOADING', 'BootstrapAjaxForm.LOADING');
        $js = <<<JS
(function(\$){
    \$(function(){
        \$('#{$name}').ajaxForm({
            delegation: true,
            target: '#AjaxForm_{$name}',
            beforeSubmit: function(data, form, options){
                \$('#{$name} [type=submit]').prop("disabled", true).html('{$loading}');
            }
\t});
    });
})(jQuery);
JS;
        Requirements::customScript($js, 'BootstrapAjaxForm_Js_' . $this->FormName());
        if (!Director::is_ajax()) {
            $this->setTemplate('BootstrapAjaxForm');
        }
    }
Example #18
0
 /**
  * Get registry settings for Phoo
  *
  * @access  public
  * @return  mixed    array with the settings or Jaws_Error on error
  */
 function GetSettings()
 {
     $ret = array();
     $ret['default_action'] = $this->gadget->registry->fetch('default_action');
     $ret['resize_method'] = $this->gadget->registry->fetch('resize_method');
     $ret['moblog_album'] = $this->gadget->registry->fetch('moblog_album');
     $ret['moblog_limit'] = $this->gadget->registry->fetch('moblog_limit');
     $ret['photoblog_album'] = $this->gadget->registry->fetch('photoblog_album');
     $ret['photoblog_limit'] = $this->gadget->registry->fetch('photoblog_limit');
     $ret['allow_comments'] = $this->gadget->registry->fetch('allow_comments');
     $ret['published'] = $this->gadget->registry->fetch('published');
     $ret['show_exif_info'] = $this->gadget->registry->fetch('show_exif_info');
     $ret['keep_original'] = $this->gadget->registry->fetch('keep_original');
     $ret['thumbnail_limit'] = $this->gadget->registry->fetch('thumbnail_limit');
     $ret['comment_status'] = $this->gadget->registry->fetch('comment_status');
     $ret['use_antispam'] = $this->gadget->registry->fetch('use_antispam');
     $ret['albums_order_type'] = $this->gadget->registry->fetch('albums_order_type');
     $ret['photos_order_type'] = $this->gadget->registry->fetch('photos_order_type');
     foreach ($ret as $r) {
         if (Jaws_Error::IsError($r)) {
             if (isset($GLOBALS['app']->Session)) {
                 $GLOBALS['app']->Session->PushLastResponse(_t('PHOO_ERROR_CANT_FETCH_SETTINGS'), RESPONSE_ERROR);
             }
             return new Jaws_Error(_t('PHOO_ERROR_CANT_FETCH_SETTINGS'));
         }
     }
     return $ret;
 }
 /**
  * Place the export button in a <p> tag below the field
  */
 public function getHTMLFragments($gridField)
 {
     $button = new GridField_FormAction($gridField, 'export', _t('TableListField.CSVEXPORT', 'Export to CSV'), 'export', null);
     $button->setAttribute('data-icon', 'download-csv');
     $button->addExtraClass('no-ajax');
     return array($this->targetFragment => '<p class="grid-csv-button">' . $button->Field() . '</p>');
 }
Example #20
0
 /**
  * Converts a HTML style hex string ('#7f6699') to an RGB array.
  */
 public static function hex_rgb($hex_string)
 {
     $hex_string = ltrim($hex_string, '#');
     if (!preg_match('/^[0-9a-f]+$/i', $hex_string)) {
         return Error::raise(_t('Not a valid hex color.'));
     }
     $normalized = '';
     switch (strlen($hex_string)) {
         case 3:
             // 'fed' = 'ffeedd'
             for ($i = 0; $i < 3; $i++) {
                 $normalized .= $hex_string[$i] . $hex_string[$i];
             }
             break;
         case 6:
             // already normal
             $normalized = $hex_string;
             break;
         case 2:
         case 4:
             // who uses this anyway!
             $normalized = $hex_string . str_repeat('0', 6 - strlen($hex_string));
             break;
         default:
             return Error::raise(_t('Not a valid color format.'));
     }
     return self::rgb_rgbarr(hexdec(substr($normalized, 0, 2)), hexdec(substr($normalized, 2, 2)), hexdec(substr($normalized, 4, 2)));
 }
Example #21
0
 function getBlockCode_Map()
 {
     $fLat = false;
     $fLng = false;
     $iZoom = false;
     $sFilter = '';
     bx_import('BxDolProfileFields');
     $oPF = new BxDolProfileFields(9);
     $aRequestParams = $oPF->collectSearchRequestParams();
     $aCountryLocation = false;
     if ($aRequestParams && isset($aRequestParams['Country']) && 1 == count($aRequestParams['Country']) && preg_match('/^[a-zA-Z]+$/', $aRequestParams['Country'][0])) {
         $r = $this->oDb->getCountryByCode($aRequestParams['Country'][0]);
         if ($r) {
             $fLat = $r['lat'];
             $fLng = $r['lng'];
             $iZoom = BX_MAP_ZOOM_CITIES;
         }
     }
     $sProfiles = '';
     if ($aRequestParams) {
         $sFilter = str_replace('/', '-slash-', base64_encode(serialize($_GET)));
         $sUrlGetProfiles = $this->oConfig->getBaseUri() . 'get_html_profiles/' . $sFilter . '?page={page}&ts={ts}';
         $aVars = array('content_id' => 'bx_map_profiles', 'content' => "<script>glBxMapProfilesMapOnLoadCallback = function () { glBxMapPage.loadProfilesList('bx_map_profiles', '{$sUrlGetProfiles}'); }; bx_map_loading('bx_map_profiles', 1) </script>", 'prev_title' => _t('_Prev'), 'prev_onclick' => "glBxMapPage.changePage('bx_map_profiles', '{$sUrlGetProfiles}', -1);", 'prev_href' => 'javascript:void(0);', 'next_title' => _t('_Next'), 'next_onclick' => "glBxMapPage.changePage('bx_map_profiles', '{$sUrlGetProfiles}', 1);", 'next_href' => 'javascript:void(0);');
         $sProfiles = $this->oTemplate->parseHtmlByName('pageable_items', $aVars);
     }
     return $sProfiles . $this->oMain->serviceSeparatePageBlock($fLat, $fLng, $iZoom, $sFilter);
 }
 /**
  * Form action handler for ContactInquiryForm.
  *
  * @param array $data The form request data submitted
  * @param Form $form The {@link Form} this was submitted on
  */
 function dosave(array $data, Form $form, SS_HTTPRequest $request)
 {
     $SQLData = Convert::raw2sql($data);
     $attrs = $form->getAttributes();
     if ($SQLData['Comment'] != '' || $SQLData['Url'] != '') {
         // most probably spam - terminate silently
         Director::redirect(Director::baseURL() . $this->URLSegment . "/success");
         return;
     }
     $item = new ContactInquiry();
     $form->saveInto($item);
     // $form->sessionMessage(_t("ContactPage.FORMMESSAGEGOOD", "Your inquiry has been submitted. Thanks!"), 'good');
     $item->write();
     $mailFrom = $this->currController->MailFrom ? $this->currController->MailFrom : $SQLData['Email'];
     $mailTo = $this->currController->MailTo ? $this->currController->MailTo : Email::getAdminEmail();
     $mailSubject = $this->currController->MailSubject ? $this->currController->MailSubject . ' - ' . $SQLData['Ref'] : _t('ContactPage.SUBJECT', '[web] New contact inquiry - ') . ' ' . $data['Ref'];
     $email = new Email($mailFrom, $mailTo, $mailSubject);
     $email->replyTo($SQLData['Email']);
     $email->setTemplate("ContactInquiry");
     $email->populateTemplate($SQLData);
     $email->send();
     // $this->controller->redirectBack();
     if ($email->send()) {
         $this->controller->redirect($this->controller->Link() . "success");
     } else {
         $this->controller->redirect($this->controller->Link() . "error");
     }
     return false;
 }
 function getBlockCode_Categories($iBlockID, $sContent)
 {
     bx_import('BxTemplCategoriesModule');
     $aParam = array('type' => $this->oMain->_sPrefix);
     $oCateg = new BxTemplCategoriesModule($aParam, _t('_categ_users'), BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'categories');
     return $oCateg->getBlockCode_Common($iBlockId, true);
 }
Example #24
0
function themeConfig($form)
{
    $logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点LOGO地址'), _t('在这里填入一个图片URL地址, 以在网站标题前加上一个LOGO'));
    $form->addInput($logoUrl);
    $sidebarBlock = new Typecho_Widget_Helper_Form_Element_Checkbox('sidebarBlock', array('ShowRecentPosts' => _t('显示最新文章'), 'ShowRecentComments' => _t('显示最近回复'), 'ShowCategory' => _t('显示分类'), 'ShowArchive' => _t('显示归档'), 'ShowOther' => _t('显示其它杂项')), array('ShowRecentPosts', 'ShowRecentComments', 'ShowCategory', 'ShowArchive', 'ShowOther'), _t('侧边栏显示'));
    $form->addInput($sidebarBlock->multiMode());
}
Example #25
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->insertAfter(new LiteralField(_t("Shop.Invoice.PDFLink", "PDF Link"), '<h5><a href="' . Director::absoluteURL($this->pdfLink()) . '" target="_blank">' . _t("Shop.Invoice.PDFLink", "PDF Link") . '</a></h5>'), "OrderID");
     $fields->insertAfter(new LiteralField(_t("Shop.Invoice.InvoiceLink", "InvoiceLink"), '<h5><a href="' . Director::absoluteURL($this->link()) . '" target="_blank">' . _t("Shop.Invoice.InvoiceLink", "Invoice Link") . '</a></h5>'), "OrderID");
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('Country');
     $fields->removeByName("DefaultShippingAddressID");
     $fields->removeByName("DefaultBillingAddressID");
     $fields->addFieldToTab('Root.Main', DropdownField::create('Country', _t('Address.db_Country', 'Country'), SiteConfig::current_site_config()->getCountriesList()));
 }
Example #27
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Bairro');
     $this->form->setFormTitle('Bairro');
     $this->form->class = 'tform';
     // CSS class
     // defines the database
     parent::setDatabase('liger');
     // defines the active record
     parent::setActiveRecord('Bairro');
     // create the form fields
     $bairros_id = new TEntry('bairros_id');
     $bairros_nome = new TEntry('bairros_nome');
     $tb_cidades_cid_id = new TDBCombo('tb_cidades_cid_id', 'liger', 'Cidade', 'cid_id', 'cid_nome');
     $bairros_id->setEditable(false);
     // add the fields
     $this->form->addQuickField('ID', $bairros_id, 50);
     $this->form->addQuickField('Bairro: ', $bairros_nome, 200);
     $this->form->addQuickField('Cidade: ', $tb_cidades_cid_id, 200);
     // add form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('BairroList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'BairroList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Get menu items array, which are ready to pass to template.
  * @return array
  */
 public function getMenuItems()
 {
     $aRet = array();
     if (!isset($this->_aObject['menu_items'])) {
         $this->_aObject['menu_items'] = $this->_oQuery->getMenuItems();
     }
     foreach ($this->_aObject['menu_items'] as $a) {
         if (isset($a['active']) && !$a['active']) {
             continue;
         }
         if (isset($a['visible_for_levels']) && !$this->_isVisible($a)) {
             continue;
         }
         $a = $this->_replaceMarkers($a);
         list($sIcon, $sIconUrl) = $this->_getMenuIcon($a);
         $a['class_wrp_act'] = 'bx-menu-inter-hidden';
         $a['class_wrp_pas'] = '';
         if ($this->_isSelected($a)) {
             $a['class_wrp_act'] = '';
             $a['class_wrp_pas'] = '******';
         }
         $a['link'] = isset($a['link']) ? $this->_oPermalinks->permalink($a['link']) : 'javascript:void(0);';
         $a['title'] = _t($a['title']);
         $a['bx_if:image'] = array('condition' => (bool) $sIconUrl, 'content' => array('icon_url' => $sIconUrl));
         $a['bx_if:icon'] = array('condition' => (bool) $sIcon, 'content' => array('icon' => $sIcon));
         $aRet[] = $a;
     }
     return $aRet;
 }
Example #29
0
    /**
     * 获取插件配置面板
     *
     * @access public
     * @param Typecho_Widget_Helper_Form $form 配置面板
     * @return void
     */
    public static function config(Typecho_Widget_Helper_Form $form)
    {
        $editorThemeOptions = array('default' => '默认风格', 'simple' => '简洁风格', 'qq' => 'QQ风格');
        $editorTheme = new Typecho_Widget_Helper_Form_Element_Select('editorTheme', $editorThemeOptions, 'default', _t('皮肤'));
        $editorLangOptions = array('zh_CN' => '中文简体', 'en' => 'English');
        $editorLang = new Typecho_Widget_Helper_Form_Element_Select('editorLang', $editorLangOptions, 'zh_CN', '语言');
        $line = new Typecho_Widget_Helper_Layout('hr');
        $editorNewlineTagOptions = array('br' => '新开始行', 'p' => '新开始段落');
        $editorNewlineTag = new Typecho_Widget_Helper_Form_Element_Radio('editorNewlineTag', $editorNewlineTagOptions, 'p', _t('回车处理'));
        $editorPasteTypeOptions = array('0' => '禁止', '1' => '纯文本', '2' => 'HTML');
        $editorPasteType = new Typecho_Widget_Helper_Form_Element_Radio('editorPasteType', $editorPasteTypeOptions, '2', _t('粘贴类型'));
        $editorToolsOptions = array('source' => 'HTML代码', '|' => '分隔', 'undo' => '后退', 'redo' => '前进', '|1' => '分隔', 'preview' => '预览', 'wordpaste' => '从Word粘贴', 'print' => '打印', 'template' => '插入模板', 'code' => '插入程序代码', 'cut' => '剪切', 'copy' => ' 复制', 'paste' => '粘贴', 'plainpaste' => '粘贴为无格式文本', '|2' => '分隔', 'selectall' => '全选', 'justifyleft' => '左对齐', 'justifycenter' => '居中', 'justifyright' => '右对齐', 'justifyfull' => '两端对齐', 'insertorderedlist' => '编号', 'insertunorderedlist' => '项目符号', 'indent' => '增加缩进', 'outdent' => '减少缩进', 'subscript' => '下标', 'superscript' => '上标', 'removeformat' => '删除格式', 'quickformat' => '一键排版', '|3' => '分隔', 'formatblock' => '段落', 'fontname' => '字体', 'fontsize' => '文字大小', '|3' => '分隔', 'forecolor' => '文字颜色', 'hilitecolor' => '文字背景', 'bold' => '粗体', 'italic' => '斜体', 'underline' => '下划线', 'strikethrough' => '删除线', '|5' => '分隔', 'image' => '图片', 'flash' => 'Flash', 'media' => '视音频', 'table' => '表格', 'hr' => '插入横线', 'emoticons' => '插入表情', 'link' => '超级链接', 'unlink' => '取消超级链接', 'fullscreen' => '全屏显示', 'map' => 'Google地图', 'baidumap' => '百度地图', 'lineheight' => '行距', 'clearhtml' => '清理HTML代码', 'pagebreak' => ' 插入分页符', 'anchor' => '插入锚点', 'insertfile' => '插入文件', '|6' => '分隔', 'about' => '关于');
        $editorToolsDescription = _t('仅在默认风格有效!');
        $editorTools = new Typecho_Widget_Helper_Form_Element_Checkbox('editorTools', $editorToolsOptions, array('fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'emoticons', 'image', 'link'), _t('工具栏'), $editorToolsDescription);
        $form->addInput($editorTheme);
        $form->addInput($editorLang);
        $form->addItem($line);
        $form->addInput($editorNewlineTag);
        $form->addInput($editorPasteType);
        $form->addItem($line);
        $form->addInput($editorTools);
        $form->addItem($line);
        echo <<<EOF
        <style>
            #typecho-option-item-editorTools-4 span{width:24%;display:inline-block;margin-right:0;}
        </style>
EOF;
    }
Example #30
0
 function getBlockCode_ActionList()
 {
     $sCode = null;
     $sMainPrefix = $this->oConfig->getMainPrefix();
     bx_import('BxDolSubscription');
     $oSubscription = BxDolSubscription::getInstance();
     $aButton = $oSubscription->getButton($this->iProfileId, $sMainPrefix, '', (int) $this->aFileInfo['medID']);
     $sCode .= $oSubscription->getData();
     $aReplacement = array('favorited' => $this->aFileInfo['favorited'] == false ? '' : 'favorited', 'featured' => (int) $this->aFileInfo['Featured'], 'featuredCpt' => '', 'approvedCpt' => '', 'approvedAct' => '', 'moduleUrl' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri(), 'fileUri' => $this->aFileInfo['medUri'], 'iViewer' => $this->iProfileId, 'ID' => (int) $this->aFileInfo['medID'], 'Owner' => (int) $this->aFileInfo['medProfId'], 'OwnerName' => $this->aFileInfo['NickName'], 'AlbumUri' => $this->aFileInfo['albumUri'], 'sbs_' . $sMainPrefix . '_title' => $aButton['title'], 'sbs_' . $sMainPrefix . '_script' => $aButton['script'], 'shareCpt' => $this->oModule->isAllowedShare($this->aFileInfo) ? _t('_Share') : '', 'downloadCpt' => $this->oModule->isAllowedDownload($this->aFileInfo) ? _t('_Download') : '');
     if (isAdmin($this->iProfileId)) {
         $sMsg = $aReplacement['featured'] > 0 ? 'un' : '';
         $aReplacement['featuredCpt'] = _t('_' . $sMainPrefix . '_action_' . $sMsg . 'feature');
     }
     if ($this->oModule->isAllowedApprove($this->aFileInfo)) {
         $sMsg = '';
         $iAppr = 1;
         if ($this->aFileInfo['Approved'] == 'approved') {
             $sMsg = 'de';
             $iAppr = 0;
         }
         $aReplacement['approvedCpt'] = _t('_' . $sMainPrefix . '_admin_' . $sMsg . 'activate');
         $aReplacement['approvedAct'] = $iAppr;
     }
     $aReplacement['repostCpt'] = $aReplacement['repostScript'] = '';
     if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
         $sCode .= BxDolService::call('wall', 'get_repost_js_script');
         $aReplacement['repostCpt'] = _t('_Repost');
         $aReplacement['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->iProfileId, $sMainPrefix, 'add', (int) $this->aFileInfo['medID']));
     }
     $sActionsList = $GLOBALS['oFunctions']->genObjectsActions($aReplacement, $sMainPrefix);
     if (is_null($sActionsList)) {
         return '';
     }
     return $sCode . $sActionsList;
 }