本文整理汇总了PHP中Element::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::select方法的具体用法?PHP Element::select怎么用?PHP Element::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element::select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateIndex
public function updateIndex($intId = 0)
{
if ($intId > 0) {
$objElement = Element::selectByPk($intId);
$objElements = new DBA__Collection();
$objElements->addObject($objElement);
} else {
$objElements = Element::select();
}
foreach ($objElements as $objElement) {
//*** Delete current index.
$this->deleteSearchIndex($objElement->getId());
//*** Get index words from the elements text field.
$strSql = sprintf("SELECT pcms_element_field_text.value as value\n\t\t\t\t\tFROM pcms_element_field_text, pcms_element_field\n\t\t\t\t\tWHERE pcms_element_field_text.fieldId = pcms_element_field.id\n\t\t\t\t\tAND pcms_element_field.elementId = '%s'", quote_smart($objElement->getId()));
$objElementFields = ElementFieldText::select($strSql);
foreach ($objElementFields as $objElementField) {
$this->insertSearchWord($objElementField->getValue(), $objElement->getId());
}
//*** Get index words from the elements bigtext field.
$strSql = sprintf("SELECT pcms_element_field_bigtext.value as value\n\t\t\t\t\tFROM pcms_element_field_bigtext, pcms_element_field\n\t\t\t\t\tWHERE pcms_element_field_bigtext.fieldId = pcms_element_field.id\n\t\t\t\t\tAND pcms_element_field.elementId = '%s'", quote_smart($objElement->getId()));
$objElementFields = ElementFieldBigText::select($strSql);
foreach ($objElementFields as $objElementField) {
$this->insertSearchWord($objElementField->getValue(), $objElement->getId());
}
}
}
示例2: getFromParent
public static function getFromParent($lngParentId, $blnRecursive = FALSE, $intElementType = ELM_TYPE_ALL, $intAccountId = 0)
{
global $_CONF;
$objReturn = NULL;
if ($intAccountId == 0) {
$intAccountId = $_CONF['app']['account']->getId();
}
$strSql = sprintf("SELECT * FROM pcms_element WHERE parentId = '%s' AND typeId IN (%s) AND accountId = '%s' ORDER BY sort", $lngParentId, $intElementType, $intAccountId);
$objElements = Element::select($strSql);
if ($objElements) {
$objReturn = new DBA__Collection();
foreach ($objElements as $objElement) {
$objReturn->addObject($objElement);
}
}
if ($blnRecursive === TRUE && is_object($objReturn)) {
foreach ($objReturn as $objElement) {
$objElement->getElements(TRUE, $intElementType, $intAccountId);
}
}
return $objReturn;
}
示例3: updateIndex
public function updateIndex($intId = 0)
{
if ($intId > 0) {
$objElement = Element::selectByPk($intId);
$objElements = new DBA__Collection();
$objElements->addObject($objElement);
} else {
$objElements = Element::select();
}
foreach ($objElements as $objElement) {
$searchIndexes = array();
$now = date('Y-m-d H:i:s');
//*** Delete current index.
$this->deleteSearchIndex($objElement->getId());
//*** Get index words from the elements text field.
$strSql = sprintf("SELECT pcms_element_field_text.value as value\n\t\t\t\t\tFROM pcms_element_field_text, pcms_element_field\n\t\t\t\t\tWHERE pcms_element_field_text.fieldId = pcms_element_field.id\n\t\t\t\t\tAND pcms_element_field.elementId = %s", self::quote($objElement->getId()));
$objElementFields = ElementFieldText::select($strSql);
foreach ($objElementFields as $objElementField) {
foreach ($this->getWords($objElementField->getValue(), self::SEARCH_WEIGHT) as $strWord => $intWeight) {
$searchIndexes[] = sprintf("('%s', '%s', '%s', '%s', '%s', '%s')", self::quote($objElement->getId()), self::quote($strWord), self::quote($intWeight), 0, $now, $now);
}
}
//*** Get index words from the elements bigtext field.
$strSql = sprintf("SELECT pcms_element_field_bigtext.value as value\n\t\t\t\t\tFROM pcms_element_field_bigtext, pcms_element_field\n\t\t\t\t\tWHERE pcms_element_field_bigtext.fieldId = pcms_element_field.id\n\t\t\t\t\tAND pcms_element_field.elementId = %s", self::quote($objElement->getId()));
$objElementFields = ElementFieldBigText::select($strSql);
foreach ($objElementFields as $objElementField) {
foreach ($this->getWords($objElementField->getValue(), self::SEARCH_WEIGHT) as $strWord => $intWeight) {
$searchIndexes[] = sprintf("('%s', '%s', '%s', '%s', '%s', '%s')", self::quote($objElement->getId()), self::quote($strWord), self::quote($intWeight), 0, $now, $now);
}
}
if (count($searchIndexes) > 0) {
$strSql = 'INSERT INTO pcms_search_index (elementId, word, count, sort, created, modified) VALUES ' . implode(',', $searchIndexes);
SearchIndex::select($strSql);
}
}
}
示例4: selectElements
public function selectElements()
{
$sql = "SELECT e_id FROM gui_element WHERE fkey_gui_id = \$1 " . "ORDER BY e_pos";
$v = array($this->id);
$t = array('s');
$res = db_prep_query($sql, $v, $t);
$elementArray = array();
while ($row = db_fetch_array($res)) {
array_push($elementArray, $row[0]);
}
$this->elementArray = array();
for ($i = 0; $i < count($elementArray); $i++) {
$currentElement = new Element();
$currentElement->select($elementArray[$i], $this->id);
array_push($this->elementArray, $currentElement);
}
return $this->elementArray;
}
示例5: getFolders
public static function getFolders($strName = "", $intParentId = 0, $blnGetOne = FALSE)
{
$objCms = PCMS_Client::getInstance();
$strSql = "SELECT pcms_element.* FROM pcms_element, pcms_element_schedule\n\t\t\t\tWHERE pcms_element.parentId = '%s'\n\t\t\t\tAND pcms_element.active = '1'\n\t\t\t\tAND pcms_element.typeId = '%s' ";
$strSql .= empty($strName) ? "" : "AND pcms_element.apiName = '%s' ";
$strSql .= "AND pcms_element.accountId = '%s'\n\t\t\t\tAND pcms_element.id IN (SELECT elementId FROM pcms_element_language\n\t\t\t\t\tWHERE languageId = '%s'\n\t\t\t\t\tAND active = '1')\n\t\t\t\tAND pcms_element.id = pcms_element_schedule.elementId\n\t\t\t\tAND pcms_element_schedule.startDate <= '%s'\n\t\t\t\tAND pcms_element_schedule.endDate >= '%s'\n\t\t\t\tORDER BY pcms_element.sort";
if (empty($strName)) {
$objElements = Element::select(sprintf($strSql, $intParentId, ELM_TYPE_FOLDER, PCMS_Client::getAccount()->getId(), $objCms->getLanguage()->getId(), self::toMysql(), self::toMysql()));
} else {
$objElements = Element::select(sprintf($strSql, $intParentId, ELM_TYPE_FOLDER, $strName, PCMS_Client::getAccount()->getId(), $objCms->getLanguage()->getId(), self::toMysql(), self::toMysql()));
}
if ($blnGetOne) {
if ($objElements->count() > 0) {
$objElement = new __Element($objElements->current());
return $objElement;
} else {
$objReturn = new __Element();
}
} else {
$objReturn = new __Elements();
}
foreach ($objElements as $objElement) {
$objReturn->addObject(new __Element($objElement));
}
return $objReturn;
}
示例6: importIn
public static function importIn($strXml, $intElementId, $intTemplateId, $intAccountId, $importTemplates = true, $importElements = true, $validate = true)
{
global $objLiveAdmin, $intDefaultLanguage, $_CONF;
$objReturn = NULL;
$objSettings = NULL;
$blnZip = false;
$validTemplateStructure = false;
//*** Init DOM object.
$objDoc = new DOMDocument("1.0", "UTF-8");
$objDoc->formatOutput = false;
$objDoc->preserveWhiteSpace = true;
if (is_file($strXml)) {
$objZip = new dUnzip2($strXml);
if (is_object($objZip)) {
//*** Zip file.
$strXml = $objZip->unzip('data.xml');
if ($strXml !== false) {
//*** Fix a unicode bug. Replace forbidden characters (The first 8).
for ($intCount = 1; $intCount < 9; $intCount++) {
$strHex = str_pad(dechex($intCount), 4, "0", STR_PAD_LEFT);
$strXml = preg_replace('/\\x{' . $strHex . '}/u', "", $strXml);
}
$strXml = preg_replace('/\\x{001f}/u', "", $strXml);
$objDoc->loadXML($strXml);
$blnZip = true;
}
} else {
//*** XML file.
$objDoc->load($strXml);
}
} else {
$objDoc->loadXML($strXml);
}
$arrUserIds = array();
$arrGroupIds = array();
$arrStorageIds = array();
$arrFeedIds = array();
$arrLanguageIds[0] = 0;
$arrTemplateIds[0] = 0;
$arrTemplateFieldIds[0] = 0;
$arrLinkFieldIds = array();
$arrElementIds[0] = 0;
$arrElementFieldIds = array();
$arrElementFieldIds["link"][0] = 0;
$arrElementFieldIds["largeText"][0] = 0;
if ($validate) {
//*** validate template structure
foreach ($objDoc->childNodes as $rootNode) {
foreach ($rootNode->childNodes as $logicNode) {
if ($logicNode->nodeName == "logic") {
foreach ($logicNode->childNodes as $childNode) {
switch ($childNode->nodeName) {
case "templates":
$validTemplateStructure = ImpEx::validateImportTemplates($childNode, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds, $intTemplateId);
break;
}
}
}
}
}
}
if ($validTemplateStructure || !$validate) {
//*** Import elements
foreach ($objDoc->childNodes as $rootNode) {
foreach ($rootNode->childNodes as $logicNode) {
if ($logicNode->nodeName == "logic") {
foreach ($logicNode->childNodes as $childNode) {
switch ($childNode->nodeName) {
case "languages":
// Get all languages
$arrCurrentLangs = array();
$objContentLangs = ContentLanguage::select();
$objDefaultLang = NULL;
foreach ($objContentLangs as $objContentLang) {
$arrCurrentLangs[$objContentLang->getAbbr()] = $objContentLang->getId();
if ($objContentLang->default == 1) {
$objDefaultLang = $objContentLang;
}
}
$arrLanguageIds[0] = 0;
// loop trough languages from export
foreach ($childNode->childNodes as $languageNode) {
// if abbreviations match, use that language ID
if (array_key_exists($languageNode->getAttribute('abbr'), $arrCurrentLangs)) {
$arrLanguageIds[$languageNode->getAttribute("id")] = $arrCurrentLangs[$languageNode->getAttribute('abbr')];
} else {
// if no match, use default current language
$arrLanguageIds[$languageNode->getAttribute("id")] = $arrCurrentLangs[$objDefaultLang->getAbbr()];
}
}
break;
case "templates":
if ($importTemplates) {
//*** Add templates to the account.
self::importTemplates($childNode, $_CONF['app']['account']->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds, $intTemplateId);
}
break;
case "elements":
if ($importElements) {
if ($intElementId == NULL) {
//.........这里部分代码省略.........
示例7: getElementsByTemplateId
public static function getElementsByTemplateId($intId, $blnGetOne = FALSE)
{
global $_CONF;
$strSql = "SELECT pcms_element.* FROM pcms_element, pcms_template\n\t\t\t\tWHERE pcms_element.accountId = '%s'\n\t\t\t\tAND pcms_element.templateId = pcms_template.id\n\t\t\t\tAND pcms_template.id = '%s'\n\t\t\t\tORDER BY pcms_element.sort";
$objElements = Element::select(sprintf($strSql, $_CONF['app']['account']->getId(), $intId));
if ($blnGetOne && $objElements->count() > 0) {
return $objElements->current();
}
return $objElements;
}
示例8: delete
public function delete()
{
global $_CONF;
self::$__object = "ContentLanguage";
self::$__table = "pcms_language";
//*** Remove all field values for this language.
$objElements = Element::select();
foreach ($objElements as $objElement) {
$objFields = $objElement->getFields();
foreach ($objFields as $objField) {
$objValue = $objField->getValueObject($this->id);
$objValue->delete();
}
}
//*** Remove all elements linked to this language.
ElementLanguage::deleteByLanguage($this->getId());
if (class_exists("AuditLog")) {
AuditLog::addLog(AUDIT_TYPE_LANGUAGE, $this->getId(), $this->getName(), "delete");
}
return parent::delete();
}