Ejemplo n.º 1
0
 /**
  * 
  * @param SJB_PageConfig $page_config
  */
 public static function getPage($page_config)
 {
     SJB_System::setPageTitle($page_config->getPageTitle());
     SJB_System::setGlobalTemplateVariable('user_page_uri', $page_config->getPageUri());
     SJB_System::setPageKeywords($page_config->getPageKeywords());
     SJB_System::setPageDescription($page_config->getPageDescription());
     if ($page_config->getMainContentFunction() == 'add_listing') {
         $passed_parameters_via_uri = SJB_Request::getVar('passed_parameters_via_uri', false);
         if ($passed_parameters_via_uri) {
             $passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
             if (isset($passed_parameters_via_uri[2])) {
                 $page_config->setMainContentFunction('add_listing_step');
             }
         }
     }
     $maincontent = SJB_System::executeFunction($page_config->getMainContentModule(), $page_config->getMainContentFunction(), $page_config->getParameters(), $page_config->getPageUri());
     if ($page_config->hasRawOutput()) {
         return $maincontent;
     }
     $page_templates_set_name = SJB_System::getSystemSettings('PAGE_TEMPLATES_MODULE_NAME');
     $template_supplier = new SJB_TemplateSupplier($page_templates_set_name);
     $tp = new SJB_TemplateProcessor($template_supplier);
     // assign 'highlight_templates' variable to main or index template
     if (SJB_Settings::getSettingByName('highlight_templates') == 1 && SJB_Request::getVar('admin_mode', false, 'COOKIE')) {
         $tp->assign('highlight_templates', true);
     }
     if ($errors = SJB_Error::getErrorContent()) {
         SJB_FlashMessages::getInstance()->addWarning($errors);
     }
     $tp->assign('MAIN_CONTENT', $maincontent);
     $tp->registerGlobalVariables();
     $tp->assign('sjb_version', SJB_System::getSystemSettings('SJB_VERSION'));
     $template = $page_config->getPageTemplate();
     $template_supplier->addContainerTemplate($template);
     if (SJB_Request::isAjax()) {
         $template = SJB_System::getSettingByName('default_page_template_by_http');
     } elseif (SJB_FormBuilderManager::getIfBuilderModeIsSet()) {
         $template = 'index_b.tpl';
     } else {
         if (empty($template)) {
             $template = SJB_Settings::getSettingByName('DEFAULT_PAGE_TEMPLATE');
         }
     }
     return $tp->fetch($template);
 }
Ejemplo n.º 2
0
 public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
 {
     if (SJB_FlashMessages::getInstance()->isErrors()) {
         return;
     }
     $compile_id = $this->module_name;
     if (SJB_HelperFunctions::debugModeIsTurnedOn()) {
         SJB_HelperFunctions::debugInfoPush(array($compile_id => $template), 'TEMPLATE_PROCESSOR');
     }
     parent::display($this->templateSupplier->getTplName($template), $cache_id, $compile_id, $parent);
 }
Ejemplo n.º 3
0
 /**
  * @param $listingSID
  * @return mixed
  * @throws Exception
  */
 public function postListing($listingSID)
 {
     $listing = SJB_ListingManager::getObjectBySID($listingSID);
     if (!$listing instanceof SJB_Listing) {
         $params = array($listingSID);
         $message = 'Listing #$param_0 does not exist in system';
         throw new SJB_FeedException($message, $params);
     }
     $listingInfo = SJB_ListingManager::createTemplateStructureForListing($listing);
     $listingUrl = SJB_ListingManager::getListingUrlBySID($listingSID);
     $link = " {$listingUrl} {$this->feedInfo['hash_tags']}";
     $userInfo = SJB_Array::get($listingInfo, 'user');
     $this->tp->assign('post_template', $this->feedInfo['post_template']);
     $this->tp->assign('listing', $listingInfo);
     $this->tp->assign('user', $userInfo);
     $text = $this->tp->fetch($this->template);
     $picture = $userInfo['Logo']['file_url'] == null ? SJB_System::getSystemSettings('SITE_URL') . '/' . SJB_TemplatePathManager::getAbsoluteImagePath(SJB_TemplateSupplier::getUserCurrentTheme(), 'main', 'logo.png') : $userInfo['Logo']['file_url'];
     return $this->postToWall($listingSID, $text . $link, $listingUrl, $picture);
 }
Ejemplo n.º 4
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $listingTypeSID = 0;
     if (isset($_REQUEST['passed_parameters_via_uri'])) {
         $params = SJB_FixedUrlParamProvider::getParams($_REQUEST);
         if ($params) {
             $listingTypeID = array_pop($params);
             $listingTypeSID = SJB_ListingTypeManager::getListingTypeSIDByID($listingTypeID);
         }
     }
     if (!$listingTypeSID) {
         $errors['WRONG_LISTING_TYPE_ID_SPECIFIED'] = true;
     } else {
         $listing = new SJB_Listing(array(), $listingTypeSID);
         $listing->addIDProperty();
         $listing->addActivationDateProperty();
         $listing->addUsernameProperty();
         $listing->addKeywordsProperty();
         $listing->addPicturesProperty();
         $listing->addListingTypeIDProperty();
         $listing->addPostedWithinProperty();
         $listingTypeID = SJB_ListingTypeManager::getListingTypeIDBySID($listing->listing_type_sid);
         $display_form = new SJB_Form($listing);
         $display_form->registerTags($tp);
         $form_fields = $display_form->getFormFieldsInfo();
         $listing_structure = SJB_ListingManager::createTemplateStructureForListing($listing);
         $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
         $tp->assign('METADATA', array('listing' => $metaDataProvider->getMetaData($listing_structure['METADATA']), 'form_fields' => $metaDataProvider->getFormFieldsMetadata($form_fields)));
         $tp->assign('form_fields', $form_fields);
         $tp->filterThenAssign('listing', $listing_structure);
         $formBuilder = SJB_FormBuilderManager::getFormBuilder(SJB_FormBuilderManager::FORM_BUILDER_TYPE_DISPLAY, $listingTypeID);
         $formBuilder->setChargedTemplateProcessor($tp);
         $tp->assign('listingTypeInfo', SJB_ListingTypeManager::getListingTypeInfoBySID($listingTypeSID));
         $tp->assign('currentTheme', SJB_TemplateSupplier::getUserCurrentTheme());
     }
     $tp->assign('errors', $errors);
     $tp->display('bf_displaylisting.tpl');
 }
Ejemplo n.º 5
0
 /**
  * Fetch a template's modification time from database
  *
  * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the compile template source.
  * @param string $name template name
  * @return integer timestamp (epoch) the template was modified
  */
 protected function fetchTimestamp($name)
 {
     return $this->templateSupplier->fetchTemplateTimestamp($name);
 }
Ejemplo n.º 6
0
    /**
     * retrieve fields sids from database formbuilder table
     * @return array|bool|int
     */
    public function getOrderedFieldsSIDs()
    {
        return SJB_DB::query('SELECT `field_sid` FROM `formbuilders_fieldsholders`
			WHERE `fields_holder_id` = ?s AND `listing_type_sid` = ?n AND `theme` = ?s ORDER BY `order` ASC', $this->fieldsHolderID, self::getListingTypeSID(), SJB_TemplateSupplier::getUserCurrentTheme());
    }
Ejemplo n.º 7
0
 public function setSystemAccessType($at)
 {
     $this->accessType = $at;
     self::$theme = ThemeManager::getCurrentTheme($this->accessType);
 }
Ejemplo n.º 8
0
 /**
  * get display layout propterty name as it is saved in system
  * @static
  * @param $listingTypeID
  * @return string
  */
 public static function getDisplayLayoutNamePart($listingTypeID)
 {
     return 'display_layout_' . $listingTypeID . '_' . SJB_TemplateSupplier::getUserCurrentTheme();
 }