当前位置: 首页>>代码示例>>PHP>>正文


PHP contrexx_raw2encodedUrl函数代码示例

本文整理汇总了PHP中contrexx_raw2encodedUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP contrexx_raw2encodedUrl函数的具体用法?PHP contrexx_raw2encodedUrl怎么用?PHP contrexx_raw2encodedUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了contrexx_raw2encodedUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: contrexx_raw2encodedUrl

/**
 * Encodes a raw string or array thereof for use as a href or src
 * attribute value.
 *
 * Apply to any raw string or array that is to be used as a link or image
 * address in any tag attribute, such as a.href or img.src.
 * @param   mixed   $source       The raw string or array
 * @param   boolean $encodeDash   Encode dashes ('-') if true.
 *                                Defaults to false
 * @return  mixed                 The URL encoded string or array
 */
function contrexx_raw2encodedUrl($source, $encodeDash = false)
{
    if (is_array($source)) {
        $arr = array();
        foreach ($source as $i => $_source) {
            $arr[$i] = contrexx_raw2encodedUrl($_source, $encodeDash);
        }
        return $arr;
    }
    $cutHttp = false;
    if (!$encodeDash && substr($source, 0, 7) == 'http://') {
        $source = substr($source, 7);
        $cutHttp = true;
    }
    $source = array_map('rawurlencode', explode('/', $source));
    if ($encodeDash) {
        $source = str_replace('-', '%2D', $source);
    }
    $result = implode('/', $source);
    if ($cutHttp) {
        $result = 'http://' . $result;
    }
    return $result;
}
开发者ID:Niggu,项目名称:cloudrexx,代码行数:35,代码来源:validator.inc.php

示例2: _getDomainNameId

 /**
  * Get Domain name Id
  *
  * @param Integer $websiteId  website id
  * @param Integer $cusId      customer id
  * @param String  $domainName domain name
  *
  * @global ADO Connection $objDatabase
  *
  * @return Integer
  */
 public function _getDomainNameId($websiteId, $cusId, $domainName)
 {
     global $objDatabase;
     if (empty($domainName)) {
         return 0;
     }
     $websiteId = (int) $websiteId;
     $cusId = (int) $cusId;
     $domainName = contrexx_input2db($domainName);
     $query = "SELECT\n                        `id`\n                    FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_websites`\n                    WHERE (`url` = '{$domainName}')\n                        AND `contact_id` = {$cusId}";
     $objResult = $objDatabase->Execute($query);
     if ($objResult->RecordCount() > 0) {
         return $objResult->fields['id'];
     } else {
         $insertWebsite = $objDatabase->Execute("INSERT INTO\n                                                    `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_websites`\n                                                    SET `contact_id` = {$cusId},\n                                                        `url_type`   = 3,\n                                                        `url_profile`= 1,\n                                                        `is_primary` = '0',\n                                                        `url`        = '" . contrexx_raw2encodedUrl($domainName) . "'");
         return $objDatabase->Insert_Id();
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:29,代码来源:CrmLibrary.class.php

示例3: _getNewsPage

 function _getNewsPage()
 {
     global $objDatabase, $objInit, $_ARRAYLANG;
     \JS::activate('cx');
     // TODO: Unused
     //        $objFWUser = \FWUser::getFWUserObject();
     $newsdate = time() - 86400 * 30;
     if (!empty($_POST['newsDate'])) {
         $newsdate = $this->dateFromInput($_POST['newsDate']);
     }
     $this->_pageTitle = $_ARRAYLANG['TXT_NEWSLETTER_NEWS_IMPORT'];
     $this->_objTpl->loadTemplateFile('newsletter_news.html');
     $this->_objTpl->setVariable(array('TXT_NEWS_IMPORT' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_IMPORT'], 'TXT_DATE_SINCE' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_DATE_SINCE'], 'TXT_SELECTED_MESSAGES' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_SELECTED_MESSAGES'], 'TXT_NEXT' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_NEXT'], 'NEWS_CREATE_DATE' => $this->valueFromDate($newsdate)));
     $query = "SELECT n.id, n.date, nl.title, nl.text, n.catid, cl.name as catname, n.userid, nl.teaser_text,\n            n.teaser_image_path, n.teaser_image_thumbnail_path, tl.name as typename FROM " . DBPREFIX . "module_news n\n            LEFT JOIN " . DBPREFIX . "module_news_locale nl ON n.id = nl.news_id AND nl.lang_id=" . $objInit->userFrontendLangId . "\n            LEFT JOIN " . DBPREFIX . "module_news_categories_locale cl ON n.catid = cl.category_id AND cl.lang_id=" . $objInit->userFrontendLangId . "\n            LEFT JOIN " . DBPREFIX . "module_news_types_locale tl ON n.typeid = tl.type_id AND tl.lang_id=" . $objInit->userFrontendLangId . "\n            WHERE n.date > " . $newsdate . " AND n.status = 1 AND n.validated = '1'\n            ORDER BY cl.name ASC, n.date DESC";
     /*AND (n.startdate <> '0000-00-00 00:00:00' OR n.enddate <> '0000-00-00 00:00:00')*/
     $objNews = $objDatabase->Execute($query);
     $current_category = '';
     if ($objNews !== false) {
         while (!$objNews->EOF) {
             $this->_objTpl->setVariable(array('NEWS_CATEGORY_NAME' => contrexx_raw2xhtml($objNews->fields['catname']), 'NEWS_CATEGORY_ID' => $objNews->fields['catid']));
             if ($current_category == $objNews->fields['catid']) {
                 $this->_objTpl->hideBlock("news_category");
             }
             $current_category = $objNews->fields['catid'];
             // TODO: Unused
             //                $newstext = ltrim(strip_tags($objNews->fields['text']));
             $newsteasertext = ltrim(strip_tags($objNews->fields['teaser_text']));
             //$newslink = $this->newsletterUri.ASCMS_PROTOCOL."://".$_SERVER['HTTP_HOST'].ASCMS_PATH_OFFSET."/index.php?section=News&cmd=details&newsid=".$objNews->fields['id'];
             /*if ($objNews->fields['userid'] && ($objUser = $objFWUser->objUser->getUser($objNews->fields['userid']))) {
                   $author = htmlentities($objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET);
               } else {
                   $author = $_ARRAYLANG['TXT_ANONYMOUS'];
               }*/
             $image = $objNews->fields['teaser_image_path'];
             $thumbnail = $objNews->fields['teaser_image_thumbnail_path'];
             if (!empty($thumbnail)) {
                 $imageSrc = $thumbnail;
             } elseif (!empty($image) && file_exists(\ImageManager::getThumbnailFilename(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $image))) {
                 $imageSrc = \ImageManager::getThumbnailFilename($image);
             } elseif (!empty($image)) {
                 $imageSrc = $image;
             } else {
                 $imageSrc = '';
             }
             $this->_objTpl->setVariable(array('NEWS_ID' => $objNews->fields['id'], 'NEWS_CATEGORY_ID' => $objNews->fields['catid'], 'NEWS_TITLE' => contrexx_raw2xhtml($objNews->fields['title']), 'NEWS_IMAGE_PATH' => contrexx_raw2encodedUrl($imageSrc), 'NEWS_TEASER_TEXT' => contrexx_raw2xhtml($newsteasertext)));
             $this->_objTpl->parse("news_list");
             $objNews->MoveNext();
         }
     } else {
         $this->_objTpl->setVariable('NEWS_EMPTY_LIST', $_ARRAYLANG['TXT_NEWSLETTER_NEWS_EMPTY_LIST']);
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:52,代码来源:NewsletterManager.class.php

示例4: exportCSV

 function exportCSV($intFormId, $arrCategoryIds = null, $arrLevelIds = null, $intMaskId = null)
 {
     global $_ARRAYLANG, $_CORELANG, $_LANGID, $objDatabase;
     if ($intFormId != null) {
         $objValidator = new \FWValidator();
         $arrEntries = array();
         $arrEntriesData = array();
         $arrInputfields = array();
         $arrMask = array();
         if ($intMaskId != null && $intMaskId != 0) {
             $objResultMask = $objDatabase->Execute("SELECT\n                                                    fields, form_id\n                                                FROM\n                                                    " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_masks\n                                                WHERE id = '" . $intMaskId . "'\n                                               ");
             if ($objResultMask !== false) {
                 $arrMask = explode(',', $objResultMask->fields['fields']);
                 $intFormId = $objResultMask->fields['form_id'];
             }
         }
         $objForm = new MediaDirectoryForm($intFormId, $this->moduleName);
         $objInputfields = new MediaDirectoryInputfield($intFormId, false, null, $this->moduleName);
         $strFilename = contrexx_raw2encodedUrl($objForm->arrForms[$intFormId]['formName'][0]) . "_" . mktime() . ".csv";
         if ($arrCategoryIds != null) {
             foreach ($arrCategoryIds as $intKey => $intCategoryId) {
                 if ($arrLevelIds != null) {
                     $strDatabaseLevel = "," . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_levels AS level";
                     $strLevels = join(',', $arrLevelIds);
                     $strWhereLevel = " AND ((cat.entry_id = level.entry_id) AND (level.level_id IN (" . $strLevels . ")))";
                 }
                 $objResultCategories = $objDatabase->Execute("SELECT\n                                                                        cat.entry_id AS entryId\n                                                                    FROM\n                                                                        " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_categories AS cat\n                                                                        " . $strDatabaseLevel . "\n                                                                    WHERE\n                                                                        cat.category_id ='" . $intCategoryId . "'\n                                                                        " . $strWhereLevel . "\n                                                                   ");
                 if ($objResultCategories !== false) {
                     while (!$objResultCategories->EOF) {
                         $arrEntries[$objResultCategories->fields['entryId']] = $objResultCategories->fields['entryId'];
                         $objResultCategories->MoveNext();
                     }
                 }
             }
         } else {
             if ($arrLevelIds != null) {
                 foreach ($arrLevelIds as $intKey => $intLevelId) {
                     $objResultLevels = $objDatabase->Execute("SELECT\n                                                                        level.entry_id AS entryId\n                                                                    FROM\n                                                                        " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_levels AS level\n                                                                    WHERE\n                                                                        level.level_id ='" . $intLevelId . "'\n                                                                   ");
                     if ($objResultLevels !== false) {
                         while (!$objResultLevels->EOF) {
                             $arrEntries[$objResultLevels->fields['entryId']] = $objResultLevels->fields['entryId'];
                             $objResultLevels->MoveNext();
                         }
                     }
                 }
             } else {
                 $objEntry = new MediaDirectoryEntry($this->moduleName);
                 $objEntry->getEntries(null, null, null, null, null, null, true, null, 'n', null, null, $intFormId);
                 foreach ($objEntry->arrEntries as $intEntryId => $arrEntry) {
                     $arrEntries[$intEntryId] = $intEntryId;
                 }
             }
         }
         foreach ($arrEntries as $intKey => $intEntryId) {
             $objResultEntry = $objDatabase->Execute("SELECT\n                                                                entry.value AS value, entry.form_id AS formId, entry.field_id AS fieldId\n                                                            FROM\n                                                                " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_inputfields AS entry\n                                                            WHERE\n                                                                entry.entry_id ='" . $intEntryId . "'\n                                                            AND\n                                                                entry.lang_id ='" . $_LANGID . "'\n                                                           ");
             if ($objResultEntry !== false) {
                 while (!$objResultEntry->EOF) {
                     if ($objResultEntry->fields['formId'] == $intFormId) {
                         $arrEntriesData[$intEntryId][$objResultEntry->fields['fieldId']] = $objResultEntry->fields['value'];
                     }
                     $objResultEntry->MoveNext();
                 }
             }
         }
         foreach ($objInputfields->arrInputfields as $intFieldId => $arrField) {
             $arrInputfields[$arrField['order']]['id'] = $intFieldId;
             $arrInputfields[$arrField['order']]['name'] = $arrField['name'][0];
         }
         ksort($arrInputfields);
         header("Content-Type: text/comma-separated-values; charset=" . CONTREXX_CHARSET, true);
         header("Content-Disposition: attachment; filename=\"{$strFilename}\"", true);
         foreach ($arrInputfields as $intKey => $arrField) {
             if ($intMaskId == null || $arrMask != null && in_array($arrField['id'], $arrMask)) {
                 print self::escapeCsvValue($arrField['name']) . $this->csvSeparator;
             }
         }
         print "\r\n";
         foreach ($arrEntriesData as $intEntryId => $arrEntry) {
             foreach ($arrInputfields as $intFieldOrder => $arrField) {
                 if ($intMaskId == null || $arrMask != null && in_array($arrField['id'], $arrMask)) {
                     switch ($arrField['id']) {
                         case 1:
                             $arrCategories = self::getCategoriesLevels(1, $intEntryId);
                             $strFieldValue = join($this->elementSeparator, $arrCategories);
                             break;
                         case 2:
                             $arrLevels = self::getCategoriesLevels(2, $intEntryId);
                             $strFieldValue = join($this->elementSeparator, $arrLevels);
                             break;
                         default:
                             $strFieldValue = isset($arrEntriesData[$intEntryId][$arrField['id']]) ? $arrEntriesData[$intEntryId][$arrField['id']] : '';
                             $strFieldValue = strip_tags($strFieldValue);
                             $strFieldValue = self::escapeCsvValue($strFieldValue);
                             $strFieldValue = html_entity_decode($strFieldValue, ENT_QUOTES, CONTREXX_CHARSET);
                             break;
                     }
                     if (CONTREXX_CHARSET == 'UTF-8') {
                         $strFieldValue = utf8_decode($strFieldValue);
                     }
                     print $strFieldValue . $this->csvSeparator;
//.........这里部分代码省略.........
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:MediaDirectoryExport.class.php

示例5: _setContent


//.........这里部分代码省略.........
             while (count($pageStack)) {
                 $entry = array_pop($pageStack);
                 $page = $entry['data'][0];
                 $arrPage['level'] = $entry['attr']['level'];
                 $arrPage['node_id'] = $entry['attr']['rel_id'];
                 $children = $entry['children'];
                 $children = array_reverse($children);
                 foreach ($children as &$entry) {
                     $entry['attr']['level'] = $arrPage['level'] + 1;
                     array_push($pageStack, $entry);
                 }
                 $arrPage['catname'] = $page['title'];
                 $arrPage['catid'] = $page['attr']['id'];
                 $arrPage['lang'] = BACKEND_LANG_ID;
                 $arrPage['protected'] = $page['attr']['protected'];
                 $arrPage['type'] = \Cx\Core\ContentManager\Model\Entity\Page::TYPE_CONTENT;
                 $arrPage['alias'] = $page['title'];
                 $arrPage['frontend_access_id'] = $page['attr']['frontend_access_id'];
                 $arrPage['backend_access_id'] = $page['attr']['backend_access_id'];
                 // JsonNode does not provide those
                 //$arrPage['level'] = ;
                 //$arrPage['type'] = ;
                 //$arrPage['parcat'] = ;
                 //$arrPage['displaystatus'] = ;
                 //$arrPage['moduleid'] = ;
                 //$arrPage['startdate'] = ;
                 //$arrPage['enddate'] = ;
                 // But we can simulate level and type for our purposes: (level above)
                 $jsondata = json_decode($page['attr']['data-href']);
                 $path = $jsondata->path;
                 if (trim($jsondata->module) != '') {
                     $arrPage['type'] = \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION;
                     $module = explode(' ', $jsondata->module, 2);
                     $arrPage['modulename'] = $module[0];
                     if (count($module) > 1) {
                         $arrPage['cmd'] = $module[1];
                     }
                 }
                 $url = "'" . '[[' . \Cx\Core\ContentManager\Model\Entity\Page::PLACEHOLDER_PREFIX;
                 // TODO: This only works for regular application pages. Pages of type fallback that are linked to an application
                 //       will be parsed using their node-id ({NODE_<ID>})
                 if ($arrPage['type'] == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION && $this->_mediaMode !== 'alias') {
                     $url .= $arrPage['modulename'];
                     if (!empty($arrPage['cmd'])) {
                         $url .= '_' . $arrPage['cmd'];
                     }
                     $url = strtoupper($url);
                 } else {
                     $url .= $arrPage['node_id'];
                 }
                 // if language != current language or $alwaysReturnLanguage
                 if ($this->_frontendLanguageId != $_FRONTEND_LANGID || isset($_GET['alwaysReturnLanguage']) && $_GET['alwaysReturnLanguage'] == 'true') {
                     $url .= '_' . $this->_frontendLanguageId;
                 }
                 $url .= "]]'";
                 $this->_objTpl->setVariable(array('FILEBROWSER_ROW_CLASS' => $rowNr % 2 == 0 ? "row1" : "row2", 'FILEBROWSER_FILE_PATH_CLICK' => "javascript:{setUrl({$url},null,null,'" . \FWLanguage::getLanguageCodeById($this->_frontendLanguageId) . $path . "','page')}", 'FILEBROWSER_FILE_NAME' => $arrPage['catname'], 'FILEBROWSER_FILESIZE' => '&nbsp;', 'FILEBROWSER_FILE_ICON' => $this->_iconPath . 'htm.png', 'FILEBROWSER_FILE_DIMENSION' => '&nbsp;', 'FILEBROWSER_SPACING_STYLE' => 'style="margin-left: ' . $arrPage['level'] * 15 . 'px;"'));
                 $this->_objTpl->parse('content_files');
                 $rowNr++;
             }
             break;
         case 'Media1':
         case 'Media2':
         case 'Media3':
         case 'Media4':
             \Permission::checkAccess(7, 'static');
             //Access Media-Archive
             \Permission::checkAccess(38, 'static');
             //Edit Media-Files
             \Permission::checkAccess(39, 'static');
             //Upload Media-Files
             //Hier soll wirklich kein break stehen! Beabsichtig!
         //Upload Media-Files
         //Hier soll wirklich kein break stehen! Beabsichtig!
         default:
             if (count($this->_arrDirectories) > 0) {
                 foreach ($this->_arrDirectories as $arrDirectory) {
                     $this->_objTpl->setVariable(array('FILEBROWSER_ROW_CLASS' => $rowNr % 2 == 0 ? "row1" : "row2", 'FILEBROWSER_FILE_PATH_CLICK' => "index.php?cmd=FileBrowser&amp;standalone=true&amp;langId={$this->_frontendLanguageId}&amp;type={$this->_mediaType}&amp;path={$arrDirectory['path']}" . $ckEditor . $ckEditorFuncNum, 'FILEBROWSER_FILE_NAME' => $arrDirectory['name'], 'FILEBROWSER_FILESIZE' => '&nbsp;', 'FILEBROWSER_FILE_ICON' => $arrDirectory['icon'], 'FILEBROWSER_FILE_DIMENSION' => '&nbsp;'));
                     $this->_objTpl->parse('content_files');
                     $rowNr++;
                 }
             }
             if (count($this->_arrFiles) > 0) {
                 $arrEscapedPaths = array();
                 foreach ($this->_arrFiles as $arrFile) {
                     $arrEscapedPaths[] = contrexx_raw2encodedUrl($arrFile['path']);
                     $this->_objTpl->setVariable(array('FILEBROWSER_ROW_CLASS' => $rowNr % 2 == 0 ? "row1" : "row2", 'FILEBROWSER_ROW_STYLE' => in_array($arrFile['name'], $this->highlightedFiles) ? ' style="background: ' . $this->highlightColor . ';"' : '', 'FILEBROWSER_FILE_PATH_DBLCLICK' => "setUrl('" . contrexx_raw2xhtml($arrFile['path']) . "'," . $arrFile['width'] . "," . $arrFile['height'] . ",'')", 'FILEBROWSER_FILE_PATH_CLICK' => "javascript:{showPreview(" . (count($arrEscapedPaths) - 1) . "," . $arrFile['width'] . "," . $arrFile['height'] . ")}", 'FILEBROWSER_FILE_NAME' => contrexx_stripslashes($arrFile['name']), 'FILEBROWSER_FILESIZE' => $arrFile['size'] . ' KB', 'FILEBROWSER_FILE_ICON' => $arrFile['icon'], 'FILEBROWSER_FILE_DIMENSION' => empty($arrFile['width']) && empty($arrFile['height']) ? '' : intval($arrFile['width']) . 'x' . intval($arrFile['height'])));
                     $this->_objTpl->parse('content_files');
                     $rowNr++;
                 }
                 $this->_objTpl->setVariable('FILEBROWSER_FILES_JS', "'" . implode("','", $arrEscapedPaths) . "'");
             }
             if (array_key_exists($this->_mediaType, $this->mediaTypePaths)) {
                 $this->_objTpl->setVariable('FILEBROWSER_IMAGE_PATH', $this->mediaTypePaths[$this->_mediaType][1]);
             } else {
                 $this->_objTpl->setVariable('FILEBROWSER_IMAGE_PATH', ASCMS_CONTENT_IMAGE_WEB_PATH);
             }
             break;
     }
     $this->_objTpl->parse('fileBrowser_content');
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:FileBrowser.class.php

示例6: renderElement

 protected function renderElement($title, $level, $hasChilds, $lang, $path, $current, $page)
 {
     //make sure the page to render is inside our branch
     if (!$this->isParentNodeInsideCurrentBranch($page->getNode())) {
         return '';
     }
     //are we inside the layer bounds?
     if (!$this->isLevelInsideLayerBound($level)) {
         return '';
     }
     if (!$page->isVisible()) {
         return '';
     }
     $node = $page->getNode();
     reset($this->branchNodeIds);
     while ($node && $node->getId() != $this->activeNode->getId()) {
         if ($node->getPage(FRONTEND_LANG_ID) && !$node->getPage(FRONTEND_LANG_ID)->isVisible()) {
             return '';
         }
         $node = $node->getParent();
     }
     if (!isset($this->navigationIds[$level])) {
         $this->navigationIds[$level] = 0;
     } else {
         $this->navigationIds[$level]++;
     }
     $block = trim($this->template->_blocks['level']);
     $output = "  <li>" . $block;
     //check if we need to close any <ul>'s
     $this->lastLevel = $level;
     $style = $current ? self::StyleNameActive : self::StyleNameNormal;
     $output = str_replace('{NAME}', contrexx_raw2xhtml($title), $output);
     $output = str_replace('<li>', '<li class="' . $style . '">', $output);
     $output = str_replace('{URL}', \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . $this->virtualLanguageDirectory . contrexx_raw2encodedUrl($path), $output);
     $linkTarget = $page->getLinkTarget();
     $output = str_replace('{TARGET}', empty($linkTarget) ? '_self' : $linkTarget, $output);
     $output = str_replace('{CSS_NAME}', $page->getCssNavName(), $output);
     $output = str_replace('{PAGE_ID}', $page->getId(), $output);
     $output = str_replace('{PAGE_NODE_ID}', $page->getNode()->getId(), $output);
     $output = str_replace('{NAVIGATION_ID}', $this->navigationIds[$level], $output);
     return $output;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:42,代码来源:NestedNavigationPageTree.class.php

示例7: view_product_overview


//.........这里部分代码省略.........
         $seller_name = $seller_url;
     }
     self::$objTemplate->setVariable(array('SHOP_SELLER_NAME' => $seller_name, 'SHOP_SELLER_URL' => $seller_url));
     $formId = 0;
     $arrDefaultImageSize = $arrSize = null;
     foreach ($arrProduct as $objProduct) {
         if (!empty($product_id)) {
             self::$pageTitle = $objProduct->name();
         }
         $id = $objProduct->id();
         $productSubmitFunction = '';
         $arrPictures = Products::get_image_array_from_base64($objProduct->pictures());
         $havePicture = false;
         $arrProductImages = array();
         foreach ($arrPictures as $index => $image) {
             $thumbnailPath = $pictureLink = '';
             if (empty($image['img']) || $image['img'] == ShopLibrary::noPictureName) {
                 // We have at least one picture on display already.
                 // No need to show "no picture" three times!
                 if ($havePicture) {
                     continue;
                 }
                 $thumbnailPath = self::$defaultImage;
                 $pictureLink = '#';
                 //"javascript:alert('".$_ARRAYLANG['TXT_NO_PICTURE_AVAILABLE']."');";
                 if (empty($arrDefaultImageSize)) {
                     $arrDefaultImageSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . self::$defaultImage);
                     self::scaleImageSizeToThumbnail($arrDefaultImageSize);
                 }
                 $arrSize = $arrDefaultImageSize;
             } else {
                 $thumbnailPath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesShopWebPath() . '/' . \ImageManager::getThumbnailFilename($image['img']);
                 if ($image['width'] && $image['height']) {
                     $pictureLink = contrexx_raw2encodedUrl(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesShopWebPath() . '/' . $image['img']) . '" rel="shadowbox[' . ($formId + 1) . ']';
                     // Thumbnail display size
                     $arrSize = array($image['width'], $image['height']);
                 } else {
                     $pictureLink = '#';
                     if (!file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $thumbnailPath)) {
                         continue;
                     }
                     $arrSize = getimagesize(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $thumbnailPath);
                 }
                 self::scaleImageSizeToThumbnail($arrSize);
                 // Use the first available picture in microdata, if any
                 if (!$havePicture) {
                     $picture_url = \Cx\Core\Routing\Url::fromCapturedRequest(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesShopWebPath() . '/' . $image['img'], \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath(), array());
                     self::$objTemplate->setVariable('SHOP_PRODUCT_IMAGE', $picture_url->toString());
                     //\DBG::log("Set image to ".$picture_url->toString());
                 }
             }
             $arrProductImages[] = array('THUMBNAIL' => contrexx_raw2encodedUrl($thumbnailPath), 'THUMBNAIL_SIZE' => $arrSize[3], 'THUMBNAIL_LINK' => $pictureLink, 'POPUP_LINK' => $pictureLink, 'POPUP_LINK_NAME' => $_ARRAYLANG['TXT_SHOP_IMAGE'] . ' ' . $index);
             $havePicture = true;
         }
         $i = 1;
         foreach ($arrProductImages as $arrProductImage) {
             // TODO: Instead of several numbered image blocks, use a single one repeatedly
             self::$objTemplate->setVariable(array('SHOP_PRODUCT_THUMBNAIL_' . $i => $arrProductImage['THUMBNAIL'], 'SHOP_PRODUCT_THUMBNAIL_SIZE_' . $i => $arrProductImage['THUMBNAIL_SIZE']));
             if (!empty($arrProductImage['THUMBNAIL_LINK'])) {
                 self::$objTemplate->setVariable(array('SHOP_PRODUCT_THUMBNAIL_LINK_' . $i => $arrProductImage['THUMBNAIL_LINK'], 'TXT_SEE_LARGE_PICTURE' => $_ARRAYLANG['TXT_SEE_LARGE_PICTURE']));
             } else {
                 self::$objTemplate->setVariable('TXT_SEE_LARGE_PICTURE', contrexx_raw2xhtml($objProduct->name()));
             }
             if ($arrProductImage['POPUP_LINK']) {
                 self::$objTemplate->setVariable('SHOP_PRODUCT_POPUP_LINK_' . $i, $arrProductImage['POPUP_LINK']);
             }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:67,代码来源:Shop.class.php

示例8: parseDownloadAttributes

 private function parseDownloadAttributes($objDownload, $categoryId, $allowDeleteFilesFromCategory = false)
 {
     global $_ARRAYLANG, $_LANGID;
     $description = $objDownload->getDescription($_LANGID);
     if (strlen($description) > 100) {
         $shortDescription = substr($description, 0, 97) . '...';
     } else {
         $shortDescription = $description;
     }
     $imageSrc = $objDownload->getImage();
     if (!empty($imageSrc) && file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . '/' . $imageSrc)) {
         $thumb_name = \ImageManager::getThumbnailFilename($imageSrc);
         if (file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . '/' . $thumb_name)) {
             $thumbnailSrc = $thumb_name;
         } else {
             $thumbnailSrc = \ImageManager::getThumbnailFilename($this->defaultCategoryImage['src']);
         }
         $imageSrc = contrexx_raw2encodedUrl($imageSrc);
         $thumbnailSrc = contrexx_raw2encodedUrl($thumbnailSrc);
         $image = $this->getHtmlImageTag($imageSrc, htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
         $thumbnail = $this->getHtmlImageTag($thumbnailSrc, htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
     } else {
         $imageSrc = contrexx_raw2encodedUrl($this->defaultCategoryImage['src']);
         $thumbnailSrc = contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($this->defaultCategoryImage['src']));
         $image = $this->getHtmlImageTag($this->defaultCategoryImage['src'], htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
         $thumbnail = $this->getHtmlImageTag(\ImageManager::getThumbnailFilename($this->defaultCategoryImage['src']), htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
     }
     // parse delete icon link
     if ($allowDeleteFilesFromCategory || $this->userId && $objDownload->getOwnerId() == $this->userId) {
         $deleteIcon = $this->getHtmlDeleteLinkIcon($objDownload->getId(), htmlspecialchars(str_replace("'", "\\'", $objDownload->getName($_LANGID)), ENT_QUOTES, CONTREXX_CHARSET), 'downloadsDeleteFile');
     } else {
         $deleteIcon = '';
     }
     $this->objTemplate->setVariable(array('TXT_DOWNLOADS_DOWNLOAD' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOAD'], 'TXT_DOWNLOADS_ADDED_BY' => $_ARRAYLANG['TXT_DOWNLOADS_ADDED_BY'], 'TXT_DOWNLOADS_LAST_UPDATED' => $_ARRAYLANG['TXT_DOWNLOADS_LAST_UPDATED'], 'TXT_DOWNLOADS_DOWNLOADED' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADED'], 'TXT_DOWNLOADS_VIEWED' => $_ARRAYLANG['TXT_DOWNLOADS_VIEWED'], 'DOWNLOADS_FILE_ID' => $objDownload->getId(), 'DOWNLOADS_FILE_DETAIL_SRC' => CONTREXX_SCRIPT_PATH . $this->moduleParamsHtml . '&amp;category=' . $categoryId . '&amp;id=' . $objDownload->getId(), 'DOWNLOADS_FILE_NAME' => htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_FILE_DESCRIPTION' => nl2br(htmlentities($description, ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_SHORT_DESCRIPTION' => htmlentities($shortDescription, ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_FILE_IMAGE' => $image, 'DOWNLOADS_FILE_IMAGE_SRC' => $imageSrc, 'DOWNLOADS_FILE_THUMBNAIL' => $thumbnail, 'DOWNLOADS_FILE_THUMBNAIL_SRC' => $thumbnailSrc, 'DOWNLOADS_FILE_ICON' => $this->getHtmlImageTag($objDownload->getIcon(), htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_FILE_TYPE_ICON' => $this->getHtmlImageTag($objDownload->getFileIcon(), htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_DELETE_ICON' => $deleteIcon, 'DOWNLOADS_FILE_DOWNLOAD_LINK_SRC' => CONTREXX_SCRIPT_PATH . $this->moduleParamsHtml . '&amp;download=' . $objDownload->getId(), 'DOWNLOADS_FILE_OWNER' => $this->getParsedUsername($objDownload->getOwnerId()), 'DOWNLOADS_FILE_OWNER_ID' => $objDownload->getOwnerId(), 'DOWNLOADS_FILE_SRC' => htmlentities($objDownload->getSourceName(), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_FILE_LAST_UPDATED' => date(ASCMS_DATE_FORMAT, $objDownload->getMTime()), 'DOWNLOADS_FILE_VIEWS' => $objDownload->getViewCount(), 'DOWNLOADS_FILE_DOWNLOAD_COUNT' => $objDownload->getDownloadCount()));
     // parse size
     if ($this->arrConfig['use_attr_size']) {
         $this->objTemplate->setVariable(array('TXT_DOWNLOADS_SIZE' => $_ARRAYLANG['TXT_DOWNLOADS_SIZE'], 'DOWNLOADS_FILE_SIZE' => $this->getFormatedFileSize($objDownload->getSize())));
         $this->objTemplate->touchBlock('download_size_information');
         $this->objTemplate->touchBlock('download_size_list');
     } else {
         $this->objTemplate->hideBlock('download_size_information');
         $this->objTemplate->hideBlock('download_size_list');
     }
     // parse license
     if ($this->arrConfig['use_attr_license']) {
         $this->objTemplate->setVariable(array('TXT_DOWNLOADS_LICENSE' => $_ARRAYLANG['TXT_DOWNLOADS_LICENSE'], 'DOWNLOADS_FILE_LICENSE' => htmlentities($objDownload->getLicense(), ENT_QUOTES, CONTREXX_CHARSET)));
         $this->objTemplate->touchBlock('download_license_information');
         $this->objTemplate->touchBlock('download_license_list');
     } else {
         $this->objTemplate->hideBlock('download_license_information');
         $this->objTemplate->hideBlock('download_license_list');
     }
     // parse version
     if ($this->arrConfig['use_attr_version']) {
         $this->objTemplate->setVariable(array('TXT_DOWNLOADS_VERSION' => $_ARRAYLANG['TXT_DOWNLOADS_VERSION'], 'DOWNLOADS_FILE_VERSION' => htmlentities($objDownload->getVersion(), ENT_QUOTES, CONTREXX_CHARSET)));
         $this->objTemplate->touchBlock('download_version_information');
         $this->objTemplate->touchBlock('download_version_list');
     } else {
         $this->objTemplate->hideBlock('download_version_information');
         $this->objTemplate->hideBlock('download_version_list');
     }
     // parse author
     if ($this->arrConfig['use_attr_author']) {
         $this->objTemplate->setVariable(array('TXT_DOWNLOADS_AUTHOR' => $_ARRAYLANG['TXT_DOWNLOADS_AUTHOR'], 'DOWNLOADS_FILE_AUTHOR' => htmlentities($objDownload->getAuthor(), ENT_QUOTES, CONTREXX_CHARSET)));
         $this->objTemplate->touchBlock('download_author_information');
         $this->objTemplate->touchBlock('download_author_list');
     } else {
         $this->objTemplate->hideBlock('download_author_information');
         $this->objTemplate->hideBlock('download_author_list');
     }
     // parse website
     if ($this->arrConfig['use_attr_website']) {
         $this->objTemplate->setVariable(array('TXT_DOWNLOADS_WEBSITE' => $_ARRAYLANG['TXT_DOWNLOADS_WEBSITE'], 'DOWNLOADS_FILE_WEBSITE' => $this->getHtmlLinkTag(htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET), htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET), htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_WEBSITE_SRC' => htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET)));
         $this->objTemplate->touchBlock('download_website_information');
         $this->objTemplate->touchBlock('download_website_list');
     } else {
         $this->objTemplate->hideBlock('download_website_information');
         $this->objTemplate->hideBlock('download_website_list');
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:80,代码来源:Downloads.class.php

示例9: _overviewMedia


//.........这里部分代码省略.........
                    $class = $i % 2 ? 'row2' : 'row1';
                    // highlight
                    if (in_array($dirTree[$key]['name'][$x], $this->highlightName)) {
                        $class .= '" style="background-color: ' . $this->highlightColor . ';';
                    }
                    if (!$this->manageAccessGranted()) {
                        //if the user is not allowed to delete or rename files -- hide those blocks
                        if ($this->_objTpl->blockExists('manage_access_option')) {
                            $this->_objTpl->hideBlock('manage_access_option');
                        }
                    }
                    $this->_objTpl->setVariable(array('MEDIA_DIR_TREE_ROW' => $class, 'MEDIA_FILE_ICON' => $dirTree[$key]['icon'][$x], 'MEDIA_FILE_NAME' => $dirTree[$key]['name'][$x], 'MEDIA_FILE_SIZE' => $this->_formatSize($dirTree[$key]['size'][$x]), 'MEDIA_FILE_TYPE' => $this->_formatType($dirTree[$key]['type'][$x]), 'MEDIA_FILE_DATE' => $this->_formatDate($dirTree[$key]['date'][$x]), 'MEDIA_RENAME_TITLE' => $_ARRAYLANG['TXT_MEDIA_RENAME'], 'MEDIA_DELETE_TITLE' => $_ARRAYLANG['TXT_MEDIA_DELETE']));
                    $tmpHref = $delHref = '';
                    if ($key == 'dir') {
                        $tmpHref = CONTREXX_SCRIPT_PATH . '?section=' . $this->archive . $this->getCmd . '&amp;path=' . rawurlencode($this->webPath . $dirTree[$key]['name'][$x] . '/');
                        $delHref = CONTREXX_SCRIPT_PATH . '?section=' . $this->archive . $this->getCmd . '&amp;act=delete&amp;path=' . rawurlencode($this->webPath . $dirTree[$key]['name'][$x] . '/');
                    } elseif ($key == 'file') {
                        $delHref = CONTREXX_SCRIPT_PATH . '?section=' . $this->archive . $this->getCmd . '&amp;act=delete&amp;path=' . rawurlencode($this->webPath) . '&amp;file=' . rawurlencode($dirTree[$key]['name'][$x]);
                        if ($this->_isImage($this->path . $dirTree[$key]['name'][$x])) {
                            $tmpSize = getimagesize($this->path . $dirTree[$key]['name'][$x]);
                            $tmpHref = 'javascript: preview(\'' . $this->webPath . $dirTree[$key]['name'][$x] . '\', ' . $tmpSize[0] . ', ' . $tmpSize[1] . ');';
                        } else {
                            $tmpHref = CONTREXX_SCRIPT_PATH . '?section=' . $this->archive . '&amp;act=download&amp;path=' . rawurlencode($this->webPath) . '&amp;file=' . rawurlencode($dirTree[$key]['name'][$x]);
                        }
                    }
                    $this->_objTpl->setVariable(array('MEDIA_FILE_NAME_HREF' => $tmpHref, 'MEDIA_FILE_DELETE_HREF' => $delHref));
                    $this->_objTpl->parse('mediaDirectoryTree');
                    $i++;
                }
            }
        }
        // empty dir or php safe mode restriction
        if ($i == 0 && !@opendir($this->rootPath)) {
            $tmpMessage = !@opendir($this->path) ? 'PHP Safe Mode Restriction or wrong path' : $_ARRAYLANG['TXT_MEDIA_DIR_EMPTY'];
            $this->_objTpl->setVariable(array('TXT_MEDIA_DIR_EMPTY' => $tmpMessage, 'MEDIA_SELECT_STATUS' => ' disabled'));
            $this->_objTpl->parse('mediaEmptyDirectory');
        }
        // parse variables
        $tmpHref = CONTREXX_SCRIPT_PATH . '?section=' . $this->archive . $this->getCmd . '&amp;path=' . rawurlencode($this->webPath);
        $tmpIcon = $this->_sortingIcons();
        if ($this->_objTpl->blockExists('manage_access_header')) {
            if ($this->manageAccessGranted()) {
                $this->_objTpl->touchBlock('manage_access_header');
            } else {
                $this->_objTpl->hideBlock('manage_access_header');
            }
        }
        $this->_objTpl->setVariable(array('MEDIA_NAME_HREF' => $tmpHref . '&amp;sort=name&amp;sort_desc=' . ($this->sortBy == 'name' && !$this->sortDesc), 'MEDIA_SIZE_HREF' => $tmpHref . '&amp;sort=size&amp;sort_desc=' . ($this->sortBy == 'size' && !$this->sortDesc), 'MEDIA_TYPE_HREF' => $tmpHref . '&amp;sort=type&amp;sort_desc=' . ($this->sortBy == 'type' && !$this->sortDesc), 'MEDIA_DATE_HREF' => $tmpHref . '&amp;sort=date&amp;sort_desc=' . ($this->sortBy == 'date' && !$this->sortDesc), 'MEDIA_PERM_HREF' => $tmpHref . '&amp;sort=perm&amp;sort_desc=' . ($this->sortBy == 'perm' && !$this->sortDesc), 'TXT_MEDIA_FILE_NAME' => $_ARRAYLANG['TXT_MEDIA_FILE_NAME'], 'TXT_MEDIA_FILE_SIZE' => $_ARRAYLANG['TXT_MEDIA_FILE_SIZE'], 'TXT_MEDIA_FILE_TYPE' => $_ARRAYLANG['TXT_MEDIA_FILE_TYPE'], 'TXT_MEDIA_FILE_DATE' => $_ARRAYLANG['TXT_MEDIA_FILE_DATE'], 'TXT_MEDIA_FILE_PERM' => $_ARRAYLANG['TXT_MEDIA_FILE_PERM'], 'MEDIA_NAME_ICON' => $tmpIcon['name'], 'MEDIA_SIZE_ICON' => $tmpIcon['size'], 'MEDIA_TYPE_ICON' => $tmpIcon['type'], 'MEDIA_DATE_ICON' => $tmpIcon['date'], 'MEDIA_PERM_ICON' => $tmpIcon['perm'], 'MEDIA_JAVASCRIPT' => $this->_getJavaScriptCodePreview()));
        if (!$this->uploadAccessGranted()) {
            // if user not allowed to upload files and creating folders -- hide that blocks
            if ($this->_objTpl->blockExists('media_simple_file_upload')) {
                $this->_objTpl->hideBlock('media_simple_file_upload');
            }
            if ($this->_objTpl->blockExists('media_advanced_file_upload')) {
                $this->_objTpl->hideBlock('media_advanced_file_upload');
            }
            if ($this->_objTpl->blockExists('media_create_directory')) {
                $this->_objTpl->hideBlock('media_create_directory');
            }
        } else {
            // forms for uploading files and creating folders
            if ($this->_objTpl->blockExists('media_simple_file_upload')) {
                //data we want to remember for handling the uploaded files
                $data = array('path' => $this->path, 'webPath' => $this->webPath);
                //new uploader
                $uploader = new \Cx\Core_Modules\Uploader\Model\Entity\Uploader();
                $uploader->setData($data);
                $uploader->setCallback('mediaCallbackJs');
                $uploader->setFinishedCallback(array(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseCoreModulePath() . '/Media/Controller/MediaLibrary.class.php', '\\Cx\\Core_modules\\Media\\Controller\\MediaLibrary', 'uploadFinished'));
                $this->_objTpl->setVariable(array('TXT_MEDIA_ADD_NEW_FILE' => $_ARRAYLANG['TXT_MEDIA_ADD_NEW_FILE'], 'MEDIA_UPLOADER_CODE' => $uploader->getXHtml($_ARRAYLANG['TXT_MEDIA_BROWSE']), 'REDIRECT_URL' => '?section=' . $_REQUEST['section'] . '&path=' . contrexx_raw2encodedUrl($this->webPath)));
                $this->_objTpl->parse('media_simple_file_upload');
            }
            if ($this->_objTpl->blockExists('media_advanced_file_upload')) {
                $this->_objTpl->hideBlock('media_advanced_file_upload');
            }
            // create directory
            $this->_objTpl->setVariable(array('TXT_MEDIA_CREATE_DIRECTORY' => $_ARRAYLANG['TXT_MEDIA_CREATE_DIRECTORY'], 'TXT_MEDIA_CREATE_NEW_DIRECTORY' => $_ARRAYLANG['TXT_MEDIA_CREATE_NEW_DIRECTORY'], 'MEDIA_CREATE_DIRECTORY_URL' => CONTREXX_SCRIPT_PATH . '?section=' . $this->archive . $this->getCmd . '&amp;act=newDir&amp;path=' . $this->webPath));
            $this->_objTpl->parse('media_create_directory');
            //custom uploader
            \JS::activate('cx');
            // the uploader needs the framework
            $uploader = new \Cx\Core_Modules\Uploader\Model\Entity\Uploader();
            //create an uploader
            $uploadId = $uploader->getId();
            $uploader->setCallback('customUploader');
            $uploader->setOptions(array('id' => 'custom_' . $uploadId));
            $folderWidget = new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($_SESSION->getTempPath() . '/' . $uploadId, true);
            $folderWidgetId = $folderWidget->getId();
            $extendedFileInputCode = <<<CODE
    <script type="text/javascript">

        //uploader javascript callback function
        function customUploader(callback) {
                angular.element('#mediaBrowserfolderWidget_{$folderWidgetId}').scope().refreshBrowser();
        }
    </script>
CODE;
            $this->_objTpl->setVariable(array('UPLOADER_CODE' => $uploader->getXHtml(), 'UPLOADER_ID' => $uploadId, 'FILE_INPUT_CODE' => $extendedFileInputCode, 'FOLDER_WIDGET_CODE' => $folderWidget->getXHtml()));
        }
    }
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:101,代码来源:Media.class.php

示例10: getSearchResults

 /**
  * Gets the search results.
  * 
  * @return  mixed  Parsed content.
  */
 public function getSearchResults()
 {
     global $_ARRAYLANG;
     $this->template->addBlockfile('ADMIN_CONTENT', 'search', 'Default.html');
     if (!empty($this->term)) {
         $pages = $this->getSearchedPages();
         $countPages = $this->countSearchedPages();
         usort($pages, array($this, 'sortPages'));
         if ($countPages > 0) {
             $parameter = '&cmd=Search' . (empty($this->term) ? '' : '&term=' . contrexx_raw2encodedUrl($this->term));
             $paging = \Paging::get($parameter, '', $countPages, 0, true, null, 'pos');
             $this->template->setVariable(array('TXT_SEARCH_RESULTS_COMMENT' => sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_COMMENT'], $this->term, $countPages), 'TXT_SEARCH_TITLE' => $_ARRAYLANG['TXT_NAVIGATION_TITLE'], 'TXT_SEARCH_CONTENT_TITLE' => $_ARRAYLANG['TXT_PAGETITLE'], 'TXT_SEARCH_SLUG' => $_ARRAYLANG['TXT_CORE_CM_SLUG'], 'TXT_SEARCH_LANG' => $_ARRAYLANG['TXT_LANGUAGE'], 'SEARCH_PAGING' => $paging));
             foreach ($pages as $page) {
                 // used for alias pages, because they have no language
                 if ($page->getLang() == "") {
                     $languages = "";
                     foreach (\FWLanguage::getIdArray('frontend') as $langId) {
                         $languages[] = \FWLanguage::getLanguageCodeById($langId);
                     }
                 } else {
                     $languages = array(\FWLanguage::getLanguageCodeById($page->getLang()));
                 }
                 $aliasLanguages = implode(', ', $languages);
                 $originalPage = $page;
                 $link = 'index.php?cmd=ContentManager&amp;page=' . $page->getId();
                 if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS) {
                     $pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
                     if ($originalPage->isTargetInternal()) {
                         // is internal target, get target page
                         $originalPage = $pageRepo->getTargetPage($page);
                     } else {
                         // is an external target, set the link to the external targets url
                         $originalPage = new \Cx\Core\ContentManager\Model\Entity\Page();
                         $originalPage->setTitle($page->getTarget());
                         $link = $page->getTarget();
                     }
                 }
                 $this->template->setVariable(array('SEARCH_RESULT_BACKEND_LINK' => $link, 'SEARCH_RESULT_TITLE' => $originalPage->getTitle(), 'SEARCH_RESULT_CONTENT_TITLE' => $originalPage->getContentTitle(), 'SEARCH_RESULT_SLUG' => substr($page->getPath(), 1), 'SEARCH_RESULT_LANG' => $aliasLanguages, 'SEARCH_RESULT_FRONTEND_LINK' => \Cx\Core\Routing\Url::fromPage($page)));
                 $this->template->parse('search_result_row');
             }
         } else {
             $this->template->setVariable(array('TXT_SEARCH_NO_RESULTS' => sprintf($_ARRAYLANG['TXT_SEARCH_NO_RESULTS'], $this->term)));
         }
     } else {
         $this->template->setVariable(array('TXT_SEARCH_NO_TERM' => $_ARRAYLANG['TXT_SEARCH_NO_TERM']));
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:52,代码来源:SearchManager.class.php

示例11: getPage

 public function getPage($pos, $page_content)
 {
     global $_CONFIG, $_ARRAYLANG;
     $objTpl = new \Cx\Core\Html\Sigma('.');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
     $objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $objTpl->setTemplate($page_content);
     $objTpl->setGlobalVariable($_ARRAYLANG);
     // Load main template even if we have a cmd set
     if ($objTpl->placeholderExists('APPLICATION_DATA')) {
         $page = new \Cx\Core\ContentManager\Model\Entity\Page();
         $page->setVirtual(true);
         $page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
         $page->setModule('Search');
         // load source code
         $applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
         \LinkGenerator::parseTemplate($applicationTemplate);
         $objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
     }
     $term = isset($_REQUEST['term']) ? trim(contrexx_input2raw($_REQUEST['term'])) : '';
     if (strlen($term) >= 3) {
         $term = trim(contrexx_input2raw($_REQUEST['term']));
         $this->setTerm($term);
         $eventHandlerInstance = \Env::get('cx')->getEvents();
         $eventHandlerInstance->triggerEvent('SearchFindContent', array($this));
         if ($this->result->size() == 1) {
             $arraySearchResults[] = $this->result->toArray();
         } else {
             $arraySearchResults = $this->result->toArray();
         }
         usort($arraySearchResults, function ($a, $b) {
             if ($a['Score'] == $b['Score']) {
                 if (isset($a['Date'])) {
                     if ($a['Date'] == $b['Date']) {
                         return 0;
                     }
                     if ($a['Date'] > $b['Date']) {
                         return -1;
                     }
                     return 1;
                 }
                 return 0;
             }
             if ($a['Score'] > $b['Score']) {
                 return -1;
             }
             return 1;
         });
         $countResults = sizeof($arraySearchResults);
         if (!is_numeric($pos)) {
             $pos = 0;
         }
         $paging = getPaging($countResults, $pos, '&amp;section=Search&amp;term=' . contrexx_raw2encodedUrl($term), '<b>' . $_ARRAYLANG['TXT_SEARCH_RESULTS'] . '</b>', true);
         $objTpl->setVariable('SEARCH_PAGING', $paging);
         $objTpl->setVariable('SEARCH_TERM', contrexx_raw2xhtml($term));
         if ($countResults > 0) {
             $searchComment = sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_ORDER_BY_RELEVANCE'], contrexx_raw2xhtml($term), $countResults);
             $objTpl->setVariable('SEARCH_TITLE', $searchComment);
             $arraySearchOut = array_slice($arraySearchResults, $pos, $_CONFIG['corePagingLimit']);
             foreach ($arraySearchOut as $details) {
                 // append search term to result link
                 $link = $details['Link'];
                 if (strpos($link, '?') === false) {
                     $link .= '?';
                 } else {
                     $link .= '&';
                 }
                 $link .= 'searchTerm=' . urlencode($term);
                 // parse result into template
                 $objTpl->setVariable(array('COUNT_MATCH' => $_ARRAYLANG['TXT_RELEVANCE'] . ' ' . $details['Score'] . '%', 'LINK' => '<b><a href="' . $link . '" title="' . contrexx_raw2xhtml($details['Title']) . '">' . contrexx_raw2xhtml($details['Title']) . '</a></b>', 'SHORT_CONTENT' => contrexx_raw2xhtml($details['Content'])));
                 $objTpl->parse('search_result');
             }
             return $objTpl->get();
         }
     }
     $noresult = $term != '' ? sprintf($_ARRAYLANG['TXT_NO_SEARCH_RESULTS'], $term) : $_ARRAYLANG['TXT_PLEASE_ENTER_SEARCHTERM'];
     $objTpl->setVariable('SEARCH_TITLE', $noresult);
     return $objTpl->get();
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:79,代码来源:Search.class.php

示例12: getImageChooserBrowser

 /**
  * Returns HTML code for an image element that links to
  * the filebrowser for choosing an image file on the server
  *
  * If the optional $imagetype_key is missing (defaults to false),
  * no image type can be selected.  If it's a string, the type of the
  * Image is set to this key.  If it's an array of keys, the Image type
  * can be selected from these.
  * Uses the $id parameter as prefix for both the name and id attributes
  * of all HTML elements.  The names and respective suffixes are:
  *  - id+'img' for the name and id of the <img> tag
  *  - id+'_src' for the name and id of the hidden <input> tag for the image URI
  *  - id+'_width' for the name and id of the hidden <input> tag for the width
  *  - id+'_height' for the name and id of the hidden <input> tag for the height
  * All of the elements with a suffix will provide the current selected
  * image information when the form is posted.
  * See {@see Image::updatePostImages()} and {@see Image::uploadAndStore()}
  * for more information and examples.
  * @param   Image   $objImage       The image object
  * @param   string  $id             The base name for the elements IDs
  * @param   mixed   $imagetype_key  The optional Image type key
  * @return  string                  The HTML code for all the elements
  */
 static function getImageChooserBrowser($objImage, $id, $imagetype_key = false, $type = null, $path = null)
 {
     global $_CORELANG;
     JS::registerCode(self::getJavascript_Image(Image::PATH_NO_IMAGE));
     if (empty($objImage)) {
         $objImage = new Image(0);
     }
     $type_element = '';
     //            '<input type="hidden" id="'.$id.'_type" name="'.$id.'_type"'.
     //            ' value="'.$imagetype_key.'" />'."\n";
     // TODO: Implement...
     /*
             if (is_array($imagetype_key)) {
                 $arrImagetypeName = \Cx\Core\ImageType\Controller\ImageType::getNameArray();
                 $type_element = self::getSelect($id.'_type', $arrImagetypeName);
             }
     */
     return $type_element . '<img id="' . $id . '_img" src="' . contrexx_raw2encodedUrl(ASCMS_PATH_OFFSET . '/' . $objImage->getPath()) . '"' . ' style="width:' . $objImage->getWidth() . 'px; height:' . $objImage->getHeight() . 'px;"' . ' title="' . $_CORELANG['TXT_CORE_HTML_IMAGE_PREVIEW'] . '"' . ' alt="' . $_CORELANG['TXT_CORE_HTML_IMAGE_PREVIEW'] . '" />' . "\n" . self::getHidden($id . '_type', $imagetype_key !== false ? $imagetype_key : $objImage->getImagetypeKey(), '') . ($objImage->getPath() ? self::getClearImageCode($id) . self::getHidden($id . '_id', $objImage->getId(), '') . self::getHidden($id . '_ord', $objImage->getOrd(), '') : '') . self::getHidden($id . '_src', $objImage->getPath(), '') . self::getHidden($id . '_width', '', '') . self::getHidden($id . '_height', '', '') . '<a href="javascript:void(0);" title="' . $_CORELANG['TXT_CORE_HTML_CHOOSE_IMAGE'] . '"' . ' tabindex="' . ++self::$index_tab . '"' . ' onclick="openBrowser(\'index.php?cmd=FileBrowser&amp;standalone=true' . ($type ? '&amp;type=' . $type : '') . ($path ? '&amp;path=' . $path : '') . '\',\'' . $id . '\',' . '\'width=800,height=640,resizable=yes,status=no,scrollbars=yes\');">' . $_CORELANG['TXT_CORE_HTML_CHOOSE_IMAGE'] . "</a>\n";
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:42,代码来源:Html.class.php

示例13: getPage

 public function getPage($pos, $page_content)
 {
     global $_CONFIG, $_ARRAYLANG;
     $objTpl = new \Cx\Core\Html\Sigma('.');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
     $objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $objTpl->setTemplate($page_content);
     $objTpl->setGlobalVariable($_ARRAYLANG);
     $term = isset($_REQUEST['term']) ? trim(contrexx_input2raw($_REQUEST['term'])) : '';
     if (strlen($term) >= 3) {
         $term = trim(contrexx_input2raw($_REQUEST['term']));
         $this->setTerm($term);
         $eventHandlerInstance = \Env::get('cx')->getEvents();
         $eventHandlerInstance->triggerEvent('SearchFindContent', array($this));
         if ($this->result->size() == 1) {
             $arraySearchResults[] = $this->result->toArray();
         } else {
             $arraySearchResults = $this->result->toArray();
         }
         usort($arraySearchResults, function ($a, $b) {
             if ($a['Score'] == $b['Score']) {
                 if (isset($a['Date'])) {
                     if ($a['Date'] == $b['Date']) {
                         return 0;
                     }
                     if ($a['Date'] > $b['Date']) {
                         return -1;
                     }
                     return 1;
                 }
                 return 0;
             }
             if ($a['Score'] > $b['Score']) {
                 return -1;
             }
             return 1;
         });
         $countResults = sizeof($arraySearchResults);
         if (!is_numeric($pos)) {
             $pos = 0;
         }
         $paging = getPaging($countResults, $pos, '&amp;section=Search&amp;term=' . contrexx_raw2encodedUrl($term), '<b>' . $_ARRAYLANG['TXT_SEARCH_RESULTS'] . '</b>', true);
         $objTpl->setVariable('SEARCH_PAGING', $paging);
         $objTpl->setVariable('SEARCH_TERM', contrexx_raw2xhtml($term));
         if ($countResults > 0) {
             $searchComment = sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_ORDER_BY_RELEVANCE'], contrexx_raw2xhtml($term), $countResults);
             $objTpl->setVariable('SEARCH_TITLE', $searchComment);
             $arraySearchOut = array_slice($arraySearchResults, $pos, $_CONFIG['corePagingLimit']);
             foreach ($arraySearchOut as $details) {
                 $objTpl->setVariable(array('COUNT_MATCH' => $_ARRAYLANG['TXT_RELEVANCE'] . ' ' . $details['Score'] . '%', 'LINK' => '<b><a href="' . $details['Link'] . '" title="' . contrexx_raw2xhtml($details['Title']) . '">' . contrexx_raw2xhtml($details['Title']) . '</a></b>', 'SHORT_CONTENT' => contrexx_raw2xhtml($details['Content'])));
                 $objTpl->parse('search_result');
             }
             return $objTpl->get();
         }
     }
     $noresult = $term != '' ? sprintf($_ARRAYLANG['TXT_NO_SEARCH_RESULTS'], $term) : $_ARRAYLANG['TXT_PLEASE_ENTER_SEARCHTERM'];
     $objTpl->setVariable('SEARCH_TITLE', $noresult);
     return $objTpl->get();
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:59,代码来源:Search.class.php

示例14: view_product_edit

 /**
  * Manage products
  *
  * Add and edit products
  * @access  public
  * @return  string
  * @author  Reto Kohli <reto.kohli@comvation.com> (parts)
  */
 function view_product_edit()
 {
     global $_ARRAYLANG;
     self::store_product();
     $product_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
     $objProduct = null;
     self::$objTemplate->addBlockfile('SHOP_PRODUCTS_FILE', 'shop_products_block', 'module_shop_product_manage.html');
     self::$objTemplate->setGlobalVariable($_ARRAYLANG);
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     self::$objTemplate->setVariable(array('SHOP_DELETE_ICON' => $cx->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/delete.gif', 'SHOP_NO_PICTURE_ICON' => self::$defaultImage));
     if ($product_id > 0) {
         $objProduct = Product::getById($product_id);
     }
     if (!$objProduct) {
         $objProduct = new Product('', 0, '', '', 0, 1, 0, 0);
     }
     $this->viewpart_product_attributes($product_id);
     $arrImages = Products::get_image_array_from_base64($objProduct->pictures());
     // Virtual Categories are disabled FTTB
     //        $flagsSelection =
     //            ShopCategories::getVirtualCategoriesSelectionForFlags(
     //                $objProduct->flags()
     //            );
     //        if ($flagsSelection) {
     //            self::$objTemplate->setVariable(
     //                'SHOP_FLAGS_SELECTION', $flagsSelection);
     //        }
     //
     // media browser
     $mediaBrowserOptions = array('type' => 'button', 'data-cx-mb-startmediatype' => 'shop', 'data-cx-mb-views' => 'filebrowser', 'id' => 'media_browser_shop', 'style' => 'display:none');
     self::$objTemplate->setVariable(array('MEDIABROWSER_BUTTON' => self::getMediaBrowserButton($mediaBrowserOptions, 'setSelectedImage')));
     $distribution = $objProduct->distribution();
     // Available active frontend groups, and those assigned to the product
     $objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('type' => 'frontend', 'is_active' => true), array('group_id' => 'asc'));
     $usergroup_ids = $objProduct->usergroup_ids();
     $arrAssignedFrontendGroupId = explode(',', $usergroup_ids);
     $strActiveFrontendGroupOptions = '';
     $strAssignedFrontendGroupOptions = '';
     while ($objGroup && !$objGroup->EOF) {
         $strOption = '<option value="' . $objGroup->getId() . '">' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
         if (in_array($objGroup->getId(), $arrAssignedFrontendGroupId)) {
             $strAssignedFrontendGroupOptions .= $strOption;
         } else {
             $strActiveFrontendGroupOptions .= $strOption;
         }
         $objGroup->next();
     }
     $discount_group_count_id = $objProduct->group_id();
     $discount_group_article_id = $objProduct->article_id();
     $keywords = $objProduct->keywords();
     //die($objProduct->category_id());
     // Product assigned to multiple Categories
     $arrAssignedCategories = ShopCategories::getAssignedShopCategoriesMenuoptions($objProduct->category_id());
     // Date format for Datepicker:
     // Clear the date if none is set; there's no point in displaying
     // "01/01/1970" instead
     $start_date = $end_date = '';
     $start_time = strtotime($objProduct->date_start());
     // Note that the check for ">0" is necessary, as some systems return
     // crazy values for empty dates (it may even fail like this)!
     if ($start_time > 0) {
         $start_date = date(ASCMS_DATE_FORMAT_DATE, $start_time);
     }
     $end_time = strtotime($objProduct->date_end());
     if ($end_time > 0) {
         $end_date = date(ASCMS_DATE_FORMAT_DATE, $end_time);
     }
     //DBG::log("Dates from ".$objProduct->date_start()." ($start_time, $start_date) to ".$objProduct->date_start()." ($end_time, $end_date)");
     $websiteImagesShopPath = $cx->getWebsiteImagesShopPath() . '/';
     $websiteImagesShopWebPath = $cx->getWebsiteImagesShopWebPath() . '/';
     self::$objTemplate->setVariable(array('SHOP_PRODUCT_ID' => isset($_REQUEST['new']) ? 0 : $objProduct->id(), 'SHOP_PRODUCT_CODE' => contrexx_raw2xhtml($objProduct->code()), 'SHOP_PRODUCT_NAME' => contrexx_raw2xhtml($objProduct->name()), 'SHOP_CATEGORIES_ASSIGNED' => $arrAssignedCategories['assigned'], 'SHOP_CATEGORIES_AVAILABLE' => $arrAssignedCategories['available'], 'SHOP_CUSTOMER_PRICE' => contrexx_raw2xhtml(Currency::formatPrice($objProduct->price())), 'SHOP_RESELLER_PRICE' => contrexx_raw2xhtml(Currency::formatPrice($objProduct->resellerprice())), 'SHOP_DISCOUNT' => contrexx_raw2xhtml(Currency::formatPrice($objProduct->discountprice())), 'SHOP_SPECIAL_OFFER' => $objProduct->discount_active() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_VAT_MENUOPTIONS' => Vat::getMenuoptions($objProduct->vat_id(), true), 'SHOP_SHORT_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg('short', $objProduct->short()), 'SHOP_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg('long', $objProduct->long(), 'full'), 'SHOP_STOCK' => $objProduct->stock(), 'SHOP_MIN_ORDER_QUANTITY' => $objProduct->minimum_order_quantity(), 'SHOP_MANUFACTURER_URL' => contrexx_raw2xhtml($objProduct->uri()), 'SHOP_DATE_START' => \Html::getDatepicker('date_start', array('defaultDate' => $start_date), ''), 'SHOP_DATE_END' => \Html::getDatepicker('date_end', array('defaultDate' => $end_date), ''), 'SHOP_ARTICLE_ACTIVE' => $objProduct->active() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_B2B' => $objProduct->b2b() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_B2C' => $objProduct->b2c() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_STOCK_VISIBILITY' => $objProduct->stock_visible() ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_MANUFACTURER_MENUOPTIONS' => Manufacturer::getMenuoptions($objProduct->manufacturer_id()), 'SHOP_PICTURE1_IMG_SRC' => !empty($arrImages[1]['img']) && is_file(\ImageManager::getThumbnailFilename($websiteImagesShopPath . $arrImages[1]['img'])) ? contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($websiteImagesShopWebPath . $arrImages[1]['img'])) : self::$defaultImage, 'SHOP_PICTURE2_IMG_SRC' => !empty($arrImages[2]['img']) && is_file(\ImageManager::getThumbnailFilename($websiteImagesShopPath . $arrImages[2]['img'])) ? contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($websiteImagesShopWebPath . $arrImages[2]['img'])) : self::$defaultImage, 'SHOP_PICTURE3_IMG_SRC' => !empty($arrImages[3]['img']) && is_file(\ImageManager::getThumbnailFilename($websiteImagesShopPath . $arrImages[3]['img'])) ? contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($websiteImagesShopWebPath . $arrImages[3]['img'])) : self::$defaultImage, 'SHOP_PICTURE1_IMG_SRC_NO_THUMB' => !empty($arrImages[1]['img']) && is_file($websiteImagesShopPath . $arrImages[1]['img']) ? $websiteImagesShopWebPath . $arrImages[1]['img'] : self::$defaultImage, 'SHOP_PICTURE2_IMG_SRC_NO_THUMB' => !empty($arrImages[2]['img']) && is_file($websiteImagesShopPath . $arrImages[2]['img']) ? $websiteImagesShopWebPath . $arrImages[2]['img'] : self::$defaultImage, 'SHOP_PICTURE3_IMG_SRC_NO_THUMB' => !empty($arrImages[3]['img']) && is_file($websiteImagesShopPath . $arrImages[3]['img']) ? $websiteImagesShopWebPath . $arrImages[3]['img'] : self::$defaultImage, 'SHOP_PICTURE1_IMG_WIDTH' => $arrImages[1]['width'], 'SHOP_PICTURE1_IMG_HEIGHT' => $arrImages[1]['height'], 'SHOP_PICTURE2_IMG_WIDTH' => $arrImages[2]['width'], 'SHOP_PICTURE2_IMG_HEIGHT' => $arrImages[2]['height'], 'SHOP_PICTURE3_IMG_WIDTH' => $arrImages[3]['width'], 'SHOP_PICTURE3_IMG_HEIGHT' => $arrImages[3]['height'], 'SHOP_DISTRIBUTION_MENU' => Distribution::getDistributionMenu($objProduct->distribution(), 'distribution', 'distributionChanged();', 'style="width: 220px"'), 'SHOP_WEIGHT' => $distribution == 'delivery' ? Weight::getWeightString($objProduct->weight()) : '0 g', 'SHOP_GROUPS_AVAILABLE' => $strActiveFrontendGroupOptions, 'SHOP_GROUPS_ASSIGNED' => $strAssignedFrontendGroupOptions, 'SHOP_ACCOUNT_VALIDITY_OPTIONS' => \FWUser::getValidityMenuOptions($distribution == 'download' ? $objProduct->weight() : 0), 'SHOP_CREATE_ACCOUNT_YES_CHECKED' => empty($usergroup_ids) ? '' : \Html::ATTRIBUTE_CHECKED, 'SHOP_CREATE_ACCOUNT_NO_CHECKED' => empty($usergroup_ids) ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DISCOUNT_GROUP_COUNT_MENU_OPTIONS' => Discount::getMenuOptionsGroupCount($discount_group_count_id), 'SHOP_DISCOUNT_GROUP_ARTICLE_MENU_OPTIONS' => Discount::getMenuOptionsGroupArticle($discount_group_article_id), 'SHOP_KEYWORDS' => contrexx_raw2xhtml($keywords), 'SHOP_WEIGHT_ENABLED' => \Cx\Core\Setting\Controller\Setting::getValue('weight_enable', 'Shop') ? 1 : 0));
     return true;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:81,代码来源:ShopManager.class.php

示例15: showCategoryDetails


//.........这里部分代码省略.........
                 $this->_objTpl->setVariable('IMAGES_ROWCLASS', 'rowWarn');
             } else {
                 if ($intRowCounter % 2 == 0) {
                     $this->_objTpl->setVariable('IMAGES_ROWCLASS', 'row0');
                 } else {
                     $this->_objTpl->setVariable('IMAGES_ROWCLASS', 'row1');
                 }
             }
             ++$intRowCounter;
             if ($objResult->fields['status'] == '0') {
                 $outputActiveIcon = 'led_red.gif';
             } else {
                 $outputActiveIcon = 'led_green.gif';
             }
             if ($objResult->fields['catimg'] == '0') {
                 $outputCatimgIcon = 'preview_grey.gif';
             } else {
                 $outputCatimgIcon = 'preview.gif';
             }
             if ($objResult->fields['link'] == '') {
                 // the linkfield is empty
                 $outputLinkIconS = '<!--';
                 $outputLinkIconE = '-->';
             } else {
                 $outputLinkIconS = '';
                 $outputLinkIconE = '';
             }
             $intOutputId = $objResult->fields['id'];
             $strOutputSorting = $objResult->fields['sorting'];
             $arrOrigFileInfo = getimagesize($this->strImagePath . $objResult->fields['path']);
             $arrThumbFileInfo = getimagesize($this->strThumbnailPath . $objResult->fields['path']);
             $strOutputThumbpath = $this->strThumbnailWebPath . $objResult->fields['path'];
             $strOutputOrigpath = $this->strImageWebPath . $objResult->fields['path'];
             $strOutputName = $objSubResult->fields['name'];
             $strOutputLastedit = date('d.m.Y', $objResult->fields['lastedit']);
             $strOutputOrigReso = $arrOrigFileInfo[0] . 'x' . $arrOrigFileInfo[1];
             $strOutputOrigWidth = $arrOrigFileInfo[0] + 20;
             $strOutputOrigHeight = $arrOrigFileInfo[1] + 25;
             $strOutputOrigSize = round(filesize($this->strImagePath . $objResult->fields['path']) / 1024, 2);
             $strOutputThumbReso = $arrThumbFileInfo[0] . 'x' . $arrThumbFileInfo[1];
             $strOutputThumbSize = round(filesize($this->strThumbnailPath . $objResult->fields['path']) / 1024, 2);
             if ($objResult->fields['size_type'] == 'abs') {
                 $strOutputTypeMethod = $_ARRAYLANG['TXT_GALLERY_VALIDATE_THUMB_SIZE_ABS'];
                 $strOutputTypeSize = $objResult->fields['quality'] . '%';
             } else {
                 $strOutputTypeMethod = $_ARRAYLANG['TXT_GALLERY_VALIDATE_THUMB_SIZE_PER'] . '&nbsp;:' . $objResult->fields['size_proz'];
                 $strOutputTypeSize = $objResult->fields['quality'] . '%';
             }
             if ($this->arrSettings['show_comments'] == 'on' && $boolComment) {
                 $objSubResult = $objDatabase->Execute('    SELECT    id
                                                         FROM    ' . DBPREFIX . 'module_gallery_comments
                                                         WHERE    picid=' . $objResult->fields['id'] . '
                                                     ');
                 $strOutputCommentCount = $objSubResult->RecordCount() . ' ' . $_ARRAYLANG['TXT_GALLERY_COMMENTS'] . '<br />';
             } else {
                 // show nothing
                 $strOutputCommentCount = "";
             }
             if ($this->arrSettings['show_voting'] == 'on' && $boolVoting) {
                 $objSubResult = $objDatabase->Execute('    SELECT    mark
                                                         FROM    ' . DBPREFIX . 'module_gallery_votes
                                                         WHERE    picid=' . $objResult->fields['id'] . '
                                                     ');
                 $strOutputVotingCount = $objSubResult->RecordCount() . ' ' . $_ARRAYLANG['TXT_GALLERY_RATING'];
                 if ($strOutputVotingCount > 0) {
                     $intMark = 0;
                     while (!$objSubResult->EOF) {
                         $intMark = $intMark + $objSubResult->fields['mark'];
                         $objSubResult->MoveNext();
                     }
                     $outputVotingAverage = ', &Oslash; ' . number_format(round($intMark / $strOutputVotingCount, 1), 1, '.', '\'');
                 } else {
                     $outputVotingAverage = ', &Oslash; 0.0';
                 }
             } else {
                 // show nothing
                 $strOutputVotingCount = "";
                 $outputVotingAverage = "";
             }
             // parse the dropdown for the categories
             try {
                 $this->parseCategoryDropdown($intCatId, false);
             } catch (DatabaseError $e) {
                 $this->strErrMessage = $_ARRAYLANG['TXT_GALLERY_CATEGORY_STATUS_MESSAGE_DATABASE_ERROR'];
                 $this->strErrMessage .= $e;
                 return;
             }
             // remove last part (file name ending) if any
             $imageNameParts = explode('.', $strOutputName);
             if (count($imageNameParts) > 1) {
                 end($imageNameParts);
                 unset($imageNameParts[key($imageNameParts)]);
                 $strOutputName = implode('.', $imageNameParts);
             }
             $this->_objTpl->setVariable(array('IMAGES_ID' => contrexx_raw2xhtml($intOutputId), 'IMAGES_THUMB_PATH' => contrexx_raw2encodedUrl($strOutputThumbpath), 'IMAGE_ORIG_PATH' => contrexx_raw2encodedUrl($strOutputOrigpath), 'IMAGES_ACTIVE_ICON' => contrexx_raw2xhtml($outputActiveIcon), 'IMAGES_CATIMG_ICON' => contrexx_raw2xhtml($outputCatimgIcon), 'IMAGES_HIDE_LINKICON_S' => $outputLinkIconS, 'IMAGES_HIDE_LINKICON_E' => $outputLinkIconE, 'IMAGES_NAME' => contrexx_raw2xhtml($strOutputName), 'IMAGES_LASTEDIT' => contrexx_raw2xhtml($strOutputLastedit), 'IMAGES_ORIG_RESO' => contrexx_raw2xhtml($strOutputOrigReso), 'IMAGES_ORIG_WIDTH' => contrexx_raw2xhtml($strOutputOrigWidth), 'IMAGES_ORIG_HEIGHT' => contrexx_raw2xhtml($strOutputOrigHeight), 'IMAGES_ORIG_SIZE' => contrexx_raw2xhtml($strOutputOrigSize), 'IMAGES_THUMB_RESO' => contrexx_raw2xhtml($strOutputThumbReso), 'IMAGES_THUMB_SIZE' => contrexx_raw2xhtml($strOutputThumbSize), 'IMAGES_TYPE_METHOD' => contrexx_raw2xhtml($strOutputTypeMethod), 'IMAGES_TYPE_SIZE' => contrexx_raw2xhtml($strOutputTypeSize), 'IMAGES_SORTING' => contrexx_raw2xhtml($strOutputSorting), 'IMAGES_COMMENT_COUNT' => contrexx_raw2xhtml($strOutputCommentCount), 'IMAGES_VOTING_COUNT' => contrexx_raw2xhtml($strOutputVotingCount), 'IMAGES_VOTING_AVERAGE' => contrexx_raw2xhtml($outputVotingAverage), 'CLEAR_IMAGE_CATCH' => time()));
             $this->_objTpl->parseCurrentBlock();
         }
         $this->parseCategoryDropdown($intCatId, false, 'showCategoriesMultiAction');
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:GalleryManager.class.php


注:本文中的contrexx_raw2encodedUrl函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。