• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getTVDisplayFormat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MergeOtherDocumentContent


//.........这里部分代码省略.........
         for ($j = $i; $j < $jMax; $j++) {
             $docId = $docIds[$j];
             $docCache =& $tvInfo[$docId];
             $inArray = array_keys($docCache);
             foreach ($inArray as &$tvName) {
                 $tvName = '\'' . $this->itsMODx->db->escape($tvName) . '\'';
             }
             $inList = implode(',', $inArray);
             $sqlArray[] = '(SELECT' . ' sc.id AS docid' . ', st.name AS name' . ', IF(stc.value != \'\',stc.value,st.default_text) AS value' . ', st.display AS display' . ', st.display_params AS display_params' . ', st.type AS type' . ' FROM ' . $st . ' st' . ' LEFT JOIN ' . $stc . ' stc' . ' ON st.id = stc.tmplvarid' . ' AND stc.contentid = ' . $docId . ' INNER JOIN ' . $stt . ' stt' . ' ON stt.tmplvarid = st.id' . ' INNER JOIN ' . $sc . ' sc' . ' ON sc.id = ' . $docId . ' WHERE' . ' st.name IN (' . $inList . ')' . ' AND sc.deleted = 0' . ')';
         }
         if (count($sqlArray) == 0) {
             continue;
         }
         $sql = implode(' UNION ', $sqlArray) . ';';
         // Grab the data from the database...
         $result = $this->itsMODx->db->query($sql);
         $count = $this->itsMODx->recordCount($result);
         // Set up find and replace arrays...
         $find = array();
         $replace = array();
         for ($j = 0; $j < $count; $j++) {
             $row = $this->itsMODx->db->getRow($result);
             $docId =& $row['docid'];
             $tvName =& $row['name'];
             $tvValue =& $row['value'];
             $tvDisplay =& $row['display'];
             $tvDisplayParams =& $row['display_params'];
             $tvType =& $row['type'];
             $matches =& $tvInfo[$docId][$tvName];
             include_once $basepath . '/tmplvars.format.inc.php';
             include_once $basepath . '/tmplvars.commands.inc.php';
             $w = '100%';
             $h = '300';
             $escapedvalue = YamsUtils::PregQuoteReplacement(getTVDisplayFormat($tvName, $tvValue, $tvDisplay, $tvDisplayParams, $tvType));
             foreach ($matches as $match => $phx) {
                 $find[] = $match;
                 $replace[] = $escapedvalue;
                 // TO DO: PHx stuff...
             }
         }
         if (count($find) == 0) {
             continue;
         }
         $content = preg_replace($find, $replace, $content, -1, $nReplacements);
         if ($nReplacements > 0) {
             $contentChanged = TRUE;
         }
     }
     // release the tv cache...
     unset($tvInfo);
     // Now loop over the dv array cache and write an SQL statement
     // that will grab the information from the database
     // a maximum of YAMS_DOC_LIMIT docs at a time
     $docIds = array_keys($dvInfo);
     $nDocs = count($docIds);
     $sc = $this->itsMODx->getFullTableName('site_content');
     $dg = $this->itsMODx->getFullTableName('document_groups');
     // get document groups for current user
     $docgrp = $this->itsMODx->getUserDocGroups();
     if (is_array($docgrp)) {
         $docgrp = implode(',', $docgrp);
     }
     // get document
     if ($this->itsMODx->isFrontend()) {
         $access = 'sc.privateweb=0';
     } else {
开发者ID:GitKharytonov,项目名称:Rebind,代码行数:67,代码来源:yams.class.inc.php


示例2: getTemplateVarOutput

 /**
  * getTemplateVarOutput
  * @version 1.0.1 (2014-02-19)
  * 
  * @desc Returns an associative array containing TV rendered output values.
  * 
  * @param $idnames {array; '*'} - Which TVs to fetch - Can relate to the TV ids in the db (array elements should be numeric only) or the TV names (array elements should be names only). @required
  * @param $docid {integer; ''} - Id of a document to get. Default: an empty string which indicates the current document.
  * @param $published {0; 1; 'all'} - Document publication status. Once the parameter equals 'all', the result will be returned regardless of whether the ducuments are published or they are not. Default: 1.
  * @param $sep {string} - Separator that is used while concatenating in getTVDisplayFormat(). Default: ''.
  * 
  * @return {array; false} - Result array, or false.
  */
 function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
 {
     if (count($idnames) == 0) {
         return false;
     } else {
         $output = array();
         $vars = $idnames == '*' || is_array($idnames) ? $idnames : array($idnames);
         $docid = intval($docid) ? intval($docid) : $this->documentIdentifier;
         // remove sort for speed
         $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
         if ($result == false) {
             return false;
         } else {
             $baspath = MODX_MANAGER_PATH . 'includes';
             include_once $baspath . '/tmplvars.format.inc.php';
             include_once $baspath . '/tmplvars.commands.inc.php';
             for ($i = 0; $i < count($result); $i++) {
                 $row = $result[$i];
                 if (!$row['id']) {
                     $output[$row['name']] = $row['value'];
                 } else {
                     $output[$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $docid, $sep);
                 }
             }
             return $output;
         }
     }
 }
开发者ID:AlexJS7,项目名称:church.local,代码行数:41,代码来源:document.parser.class.inc.php


示例3: appendTV

 function appendTV($tvname, $docIDs)
 {
     global $modx;
     $baspath = MODX_MANAGER_PATH . "includes";
     include_once $baspath . "/tmplvars.format.inc.php";
     include_once $baspath . "/tmplvars.commands.inc.php";
     $tbl_site_tmplvar_contentvalues = $modx->getFullTableName('site_tmplvar_contentvalues');
     $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
     $rs = $modx->db->select("stv.name,stc.tmplvarid,stc.contentid,stv.type,stv.display,stv.display_params,stc.value", "{$tbl_site_tmplvar_contentvalues} stc LEFT JOIN {$tbl_site_tmplvars} stv ON stv.id=stc.tmplvarid ", "stv.name='{$tvname}' AND stc.contentid IN (" . implode($docIDs, ",") . ")", "stc.contentid ASC");
     $resourceArray = array();
     while ($row = $modx->db->getRow($rs)) {
         $resourceArray["#{$row['contentid']}"][$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $row['contentid']);
     }
     if (count($resourceArray) != count($docIDs)) {
         $rs = $modx->db->select('name,type,display,display_params,default_text', $tbl_site_tmplvars, "name='{$tvname}'", 1);
         $row = $modx->db->getRow($rs);
         if (strtoupper($row['default_text']) == '@INHERIT') {
             foreach ($docIDs as $id) {
                 $output = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type'], $id);
                 if (!isset($resourceArray["#{$id}"])) {
                     $resourceArray["#{$id}"][$tvname] = $output;
                 }
             }
         } else {
             $output = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type'], $row['contentid']);
             foreach ($docIDs as $id) {
                 if (!isset($resourceArray["#{$id}"])) {
                     $resourceArray["#{$id}"][$tvname] = $output;
                 }
             }
         }
     }
     return $resourceArray;
 }
开发者ID:ZerGabriel,项目名称:evolution,代码行数:34,代码来源:wayfinder.inc.php


示例4: renderTV

 public function renderTV($tvname)
 {
     $out = null;
     if ($this->getID() > 0) {
         include_once MODX_MANAGER_PATH . "includes/tmplvars.format.inc.php";
         include_once MODX_MANAGER_PATH . "includes/tmplvars.commands.inc.php";
         $tvval = $this->get($tvname);
         $param = APIHelpers::getkey($this->tvd, $tvname, array());
         $display = APIHelpers::getkey($param, 'display', '');
         $display_params = APIHelpers::getkey($param, 'display_params', '');
         $type = APIHelpers::getkey($param, 'type', '');
         $out = getTVDisplayFormat($tvname, $tvval, $display, $display_params, $type, $this->getID(), '');
     }
     return $out;
 }
开发者ID:dukeRD,项目名称:DocLister,代码行数:15,代码来源:modResource.php


示例5: getTemplateVarOutput

 function getTemplateVarOutput($idnames = array(), $docid = "", $published = 1, $sep = '')
 {
     if (count($idnames) == 0) {
         return false;
     } else {
         $output = array();
         $vars = $idnames == '*' || is_array($idnames) ? $idnames : array($idnames);
         $docid = intval($docid) ? intval($docid) : $this->documentIdentifier;
         $result = $this->getTemplateVars($vars, "*", $docid, $published, "", "", $sep);
         // remove sort for speed
         if ($result == false) {
             return false;
         } else {
             $baspath = $this->config["base_path"] . "manager/includes";
             include_once $baspath . "/tmplvars.format.inc.php";
             include_once $baspath . "/tmplvars.commands.inc.php";
             for ($i = 0; $i < count($result); $i++) {
                 $row = $result[$i];
                 if (!$row['id']) {
                     $output[$row['name']] = $row['value'];
                 } else {
                     $output[$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $docid, $sep);
                 }
             }
             return $output;
         }
     }
 }
开发者ID:rthrash,项目名称:evolution,代码行数:28,代码来源:document.parser.class.inc.php


示例6: appendTV

 function appendTV($tvname, $docIDs)
 {
     global $modx;
     $baspath = $modx->config["base_path"] . "manager/includes";
     include_once $baspath . "/tmplvars.format.inc.php";
     include_once $baspath . "/tmplvars.commands.inc.php";
     $tb1 = $modx->getFullTableName("site_tmplvar_contentvalues");
     $tb2 = $modx->getFullTableName("site_tmplvars");
     $query = "SELECT stv.name,stc.tmplvarid,stc.contentid,stv.type,stv.display,stv.display_params,stc.value";
     $query .= " FROM " . $tb1 . " stc LEFT JOIN " . $tb2 . " stv ON stv.id=stc.tmplvarid ";
     $query .= " WHERE stv.name='" . $tvname . "' AND stc.contentid IN (" . implode($docIDs, ",") . ") ORDER BY stc.contentid ASC;";
     $rs = $modx->db->query($query);
     $tot = $modx->db->getRecordCount($rs);
     $resourceArray = array();
     for ($i = 0; $i < $tot; $i++) {
         $row = @$modx->fetchRow($rs);
         $resourceArray["#{$row['contentid']}"][$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $row['contentid']);
     }
     if ($tot != count($docIDs)) {
         $query = "SELECT name,type,display,display_params,default_text";
         $query .= " FROM {$tb2}";
         $query .= " WHERE name='" . $tvname . "' LIMIT 1";
         $rs = $modx->db->query($query);
         $row = @$modx->fetchRow($rs);
         $defaultOutput = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type']);
         foreach ($docIDs as $id) {
             if (!isset($resourceArray["#{$id}"])) {
                 $resourceArray["#{$id}"][$tvname] = $defaultOutput;
             }
         }
     }
     return $resourceArray;
 }
开发者ID:hansek,项目名称:evolution,代码行数:33,代码来源:wayfinder.inc.php


示例7: getTmplVars

 /**
  *
  * @param array $contentIds
  * @return array
  */
 function getTmplVars($contentIds)
 {
     $templateVars = array();
     if ($this->config['renderTVDisplayFormat']) {
         include_once MODX_MANAGER_PATH . "includes/tmplvars.format.inc.php";
         include_once MODX_MANAGER_PATH . "includes/tmplvars.commands.inc.php";
     }
     if (count($contentIds) > 0) {
         $query1 = "\r\n            SELECT tv.name FROM " . $this->modx->getFullTableName('site_tmplvars') . " tv\r\n            LEFT JOIN " . $this->modx->getFullTableName('site_tmplvar_templates') . " stvt ON stvt.tmplvarid = tv.id\r\n            WHERE stvt.templateid IN (SELECT DISTINCT template FROM " . $this->config['tbl_catalog'] . " WHERE id IN (" . implode(',', $contentIds) . "))\r\n          ";
         $tv_names_res = $this->modx->db->query($query1);
         $tv_names = array();
         if ($this->modx->db->getRecordCount($tv_names_res) > 0) {
             $query2 = "\r\n              SELECT tv.name, tvc.value, tvc.contentid, tv.display, tv.display_params, tv.type\r\n              FROM " . $this->modx->getFullTableName('site_tmplvars') . " tv, " . $this->config['tbl_catalog_tv'] . " tvc\r\n              WHERE tv.id = tvc.tmplvarid AND tvc.contentid IN (" . implode(',', $contentIds) . ")\r\n            ";
             $tv_values_res = $this->modx->db->query($query2);
             if ($this->modx->db->getRecordCount($tv_values_res) === 0) {
                 return $templateVars;
             }
             //get tv names
             while ($row = $this->modx->db->getRow($tv_names_res)) {
                 $tv_names[] = $row['name'];
             }
             unset($row);
             //get tv values
             while ($row = $this->modx->db->getRow($tv_values_res)) {
                 if ($this->config['renderTVDisplayFormat']) {
                     $tvout = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $row['contentid']);
                     $templateVars[$row['contentid']] = !isset($templateVars[$row['contentid']]) ? array($row['name'] => $tvout) : array_merge($templateVars[$row['contentid']], array($row['name'] => $tvout));
                 } else {
                     $templateVars[$row['contentid']] = !isset($templateVars[$row['contentid']]) ? array($row['name'] => $row['value']) : array_merge($templateVars[$row['contentid']], array($row['name'] => $row['value']));
                 }
             }
             unset($row);
             //fill holes
             foreach ($templateVars as $key => &$val) {
                 $hole = array_diff($tv_names, array_keys($val));
                 foreach ($hole as $k => $v) {
                     $val[$v] = '';
                 }
             }
         }
     }
     return $templateVars;
 }
开发者ID:radist,项目名称:Shopkeeper,代码行数:48,代码来源:catalogView.class.php


示例8: getTemplateVarOutput

 function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
 {
     if (is_array($idnames) && count($idnames) == 0) {
         return false;
     } else {
         $output = array();
         $vars = $idnames == '*' || is_array($idnames) ? $idnames : array($idnames);
         $docid = intval($docid) ? intval($docid) : $this->documentIdentifier;
         $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
         // remove sort for speed
         if ($result == false) {
             return false;
         } else {
             $core_path = $this->config['core_path'];
             include_once "{$core_path}tmplvars.format.inc.php";
             include_once "{$core_path}tmplvars.commands.inc.php";
             foreach ($result as $row) {
                 if (!$row['id']) {
                     $output[$row['name']] = $row['value'];
                 } else {
                     $output[$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $docid, $sep);
                 }
             }
             return $output;
         }
     }
 }
开发者ID:Fiberalph,项目名称:evolution-jp,代码行数:27,代码来源:document.parser.class.inc.php


示例9: getTemplateVarOutput

 /**
  * getTemplateVarOutput
  * @version 1.0 (2013-03-16)
  * 
  * @desc Returns the associative array of fields and TVs of a document.
  * 
  * @note
  * Differences from the native method:
  * 	— $published parameter can be set as false, and if it is then document publication status does not matter.
  * 
  * @param $idnames {array; '*'} - Id, TVs names, or documents fields to get. @required
  * @param $docid {integer; ''} - Id of a document to get. Default: Current document.
  * @param $published {false; 0; 1} - Document publication status which does not matter if published === false. Default: false.
  * @param $sep {string} - Separator that is used while concatenating in getTVDisplayFormat(). Default: ''.
  * 
  * @return {mixed} - Массив TV или false, если что-то не так.
  */
 public static function getTemplateVarOutput($idnames = array(), $docid = "", $published = false, $sep = '')
 {
     global $modx;
     if (count($idnames) == 0) {
         return false;
     } else {
         $output = array();
         $vars = $idnames == '*' || is_array($idnames) ? $idnames : array($idnames);
         $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier;
         $result = self::getTemplateVars($vars, '*', $docid, $published, '', '');
         // remove sort for speed
         if ($result == false) {
             return false;
         } else {
             $baspath = $modx->config['base_path'] . 'manager/includes';
             include_once $baspath . '/tmplvars.format.inc.php';
             include_once $baspath . '/tmplvars.commands.inc.php';
             for ($i = 0; $i < count($result); $i++) {
                 $row = $result[$i];
                 if (!$row['id']) {
                     $output[$row['name']] = $row['value'];
                 } else {
                     $output[$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'], $docid, $sep);
                 }
             }
             return $output;
         }
     }
 }
开发者ID:AlexJS7,项目名称:church.local,代码行数:46,代码来源:modx.ddtools.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getTabId函数代码示例发布时间:2022-05-15
下一篇:
PHP getTTProductEdition函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap