예제 #1
0
 function activateVariableFields()
 {
     $typ =& $this->getTypeInfo(TRUE);
     $table = $this->getManagedTable();
     $obj = new $table();
     $obj->cid = empty($this->cid) ? 0 : $this->cid;
     if ($obj->cid) {
         list($recursive, $allowAd) = G::getAttr($obj->cid, "appcategory", "recursive", "allowAd");
     }
     $showAdvancedSearch = !$obj->cid || !$allowAd && !$recursive;
     $showCategorySearch = FALSE;
     $typ["order"][] = "str";
     if ($showAdvancedSearch) {
         $fields = ItemField::getFixAndCommonFields();
     } else {
         $fields = $obj->getFields();
     }
     foreach ($fields as $field) {
         // a cName searchable attributuma hatarozza meg, hogy van-e kategoria szelektor a search formban:
         if ($field->columnIndex == "cName") {
             $showCategorySearch = $field->displayInSearchFormCondition();
             break;
         }
     }
     if ($showCategorySearch) {
         $typ["order"][] = "categorySearch";
         $typ["order"][] = "cid";
     }
     if ($showAdvancedSearch) {
         $typ["order"][] = "advancedSearch";
     }
     foreach ($fields as $field) {
         if ($field->columnIndex != "cName") {
             $this->activateField($field);
         }
     }
     // hogy a keresesek alapbol az aktiv itemekre menjenek:
     if (isset($typ["attributes"]["status"])) {
         $typ["attributes"]["status"]["default"] = 1;
     }
     $typ["order"][] = "relationBetweenFields";
     return $fields;
 }
예제 #2
0
 function getSortType(&$sortType, &$sortSqlAttr, $isCommon, $cid, $attr)
 {
     $sortType = 0;
     $sortSqlAttr = "";
     if (preg_match("/col_(\\d+)/", $attr, $matches)) {
         if (!loadSQL($cf = new CustomField(), array("SELECT * FROM @customfield WHERE isCommon=#isCommon# AND cid=#cid# AND columnIndex='{$attr}' LIMIT 1", $isCommon, $cid))) {
             if ($cf->userField) {
                 list($cf->type, $cf->subType, $attr) = G::getAttr($cf->userField, "customfield", "type", "subType", "columnIndex");
                 $sortSqlAttr = "u.{$attr}";
             } else {
                 $sortSqlAttr = "n.{$attr}";
             }
             if ($cf->type == customfield_date) {
                 $sortType = customfield_date;
             } elseif ($cf->subType == customfield_integer || $cf->subType == customfield_float) {
                 $sortType = $cf->subType;
             }
         }
     }
 }
예제 #3
0
파일: hasmany.php 프로젝트: alencarmo/OCF
 function __construct($base, $attribute, $attrInfo)
 {
     parent::__construct($base, $attribute, $attrInfo);
     $this->otherAttr = $attrInfo["otherAttr"];
     $this->oldValues = !empty($base->id) ? G::getAttr($base->id, $base->get_class(), $attribute) : 0;
 }
예제 #4
0
파일: item.php 프로젝트: alencarmo/OCF
 function applyAfterView()
 {
     global $gorumroll;
     View::assign("customMetaTags", "");
     View::assign("navBar", "");
     if ($gorumroll->method != "showdetails") {
         return TRUE;
     }
     if ($customAdMeta = G::getAttr($this->cid, "appcategory", "customAdMeta")) {
         $customAdMeta = $this->prepareCustomMetaTags($customAdMeta);
         View::assign("customMetaTags", $customAdMeta);
         View::assign("navBar", Roll::composeNavBarPieces($this->getNavBarPieces()));
         return FALSE;
     }
     return TRUE;
 }
예제 #5
0
파일: category.php 프로젝트: alencarmo/OCF
 function getOneLevelOfCategoriesAjax()
 {
     global $gorumroll, $lll;
     list($allowAd, $recursive) = G::getAttr($gorumroll->rollid, "appcategory", "allowAd", "recursive");
     $fields = $this->getOneLevelOfCategories($gorumroll->rollid);
     if (count($fields)) {
         $values = array_map(create_function('$v', 'return $v->id;'), $fields);
         $labels = array_map(create_function('$v', 'return htmlspecialchars($v->getAttr("name"));'), $fields);
         $rels = array_map(create_function('$v', 'return $v->allowAd;'), $fields);
         array_unshift($values, 0);
         array_unshift($labels, $lll["selectCategory"]);
         array_unshift($rels, intval($allowAd || $recursive));
         $fields = GenerWidget::generSelectOptions($labels, $values, 0, '', $rels);
     } else {
         $fields = "";
     }
     echo "{ allowAd: " . intval($allowAd || $recursive) . ", fields: '" . str_replace("\n", "", addcslashes($fields, "'")) . "' }";
     die;
 }
예제 #6
0
 function makeQueryString()
 {
     global $reverseShortcuts;
     if ($this->permaLink) {
         return $this->permaLink;
     }
     $_S =& new AppSettings();
     if (!count($this->classVars) && $this->list == "appcategory" && $this->method == "showhtmllist" && $this->rollid == 0) {
         return "";
     }
     if ($this->list == "appcategory" && $this->method == "showhtmllist") {
         if ($_S->permaLinksEnabled()) {
             $permaLink = G::getAttr($this->rollid, "appcategory", "permaLink");
             if ($classVars = $this->encodeClassVars()) {
                 $permaLink .= "/{$classVars}";
             }
             $qs = $permaLink;
         } else {
             $qs = "list/" . $this->makeQueryStringFromRollIdAndClassVars();
         }
     } elseif ($this->list == "controlpanel" && $this->method == "showhtmllist") {
         $qs = "control_panel";
     } elseif ($this->list == "staticpage" && $this->method == "show") {
         $qs = urlencode($this->rollid);
     } elseif ($this->method == "showdetails") {
         if ($_S->permaLinksEnabled() && $this->list == "item") {
             //todo
             $permaLink = G::getAttr($this->rollid, "appcategory", "permaLink");
         }
         $list = isset($reverseShortcuts[$this->list]) ? $reverseShortcuts[$this->list] : $this->list;
         $qs = "{$list}/" . $this->makeQueryStringFromRollIdAndClassVars();
     } elseif ($this->list == "item_my" && $this->method == "showhtmllist" && is_string($this->rollid)) {
         $qs = "list/" . $this->makeQueryStringFromRollIdAndClassVars();
     } elseif ($this->list == "rss" && $this->method == "get") {
         $qs = "rss/" . $this->makeQueryStringFromRollIdAndClassVars();
     } else {
         $list = isset($reverseShortcuts[$this->list]) ? $reverseShortcuts[$this->list] : $this->list;
         $method = isset($reverseShortcuts[$this->method]) ? $reverseShortcuts[$this->method] : $this->method;
         $qs = "{$list}/{$method}/" . $this->makeQueryStringFromRollIdAndClassVars();
     }
     if ($qs == $_S->homeLocation) {
         $qs = "";
     }
     return $qs;
 }
예제 #7
0
 function applyCategoryFilterToSearchQuery()
 {
     global $gorumcategory;
     if ($this->recursive && $gorumcategory) {
         $wholeName = G::getAttr($gorumcategory, "appcategory", "wholeName");
         $this->query .= " AND c.wholeName LIKE '" . quoteSQL($wholeName) . "%'";
     } elseif ($this->categorySpecific && $gorumcategory) {
         $this->query .= " AND n.cid='" . quoteSQL($gorumcategory) . "'";
     }
 }
예제 #8
0
파일: itemfield.php 프로젝트: alencarmo/OCF
 function getAttr($attr)
 {
     global $lll, $useHtmlInCustomFieldNames;
     if (isset($this->id) && isset($lll[$this->id]["customfield"][$attr])) {
         return $lll[$this->id]["customfield"][$attr];
     }
     if ($attr != "name") {
         return $this->{$attr};
     }
     if (!empty($this->userField)) {
         if (isset($lll[$this->userField]["customfield"][$attr])) {
             return $lll[$this->userField]["customfield"][$attr];
         }
         list($columnIndex, $name) = G::getAttr($this->userField, "customfield", "columnIndex", "name");
         if ($name != $this->name) {
             return htmlspecialchars($this->name);
         }
         if (isset($lll["user_{$columnIndex}"])) {
             return $lll["user_{$columnIndex}"];
         }
         return $useHtmlInCustomFieldNames ? $name : htmlspecialchars($name);
     }
     if (isset($lll["item_{$this->columnIndex}"])) {
         return $lll["item_{$this->columnIndex}"];
     }
     return $useHtmlInCustomFieldNames ? $this->name : htmlspecialchars($this->name);
 }
예제 #9
0
파일: search.php 프로젝트: alencarmo/OCF
 function makeSearchQueryAdvanced($fromInstall = FALSE)
 {
     global $gorumroll;
     if ($fromInstall) {
         $cid = $this->cid;
     } elseif ($gorumroll->method == "modify") {
         $cid = $this->cid = isset($_POST["cid"]) ? $_POST["cid"] : 0;
     } elseif ($gorumroll->method == "create") {
         $cid = $this->cid = $gorumroll->rollid;
     } else {
         $cid = $this->cid = 0;
     }
     $fields = $this->activateVariableFields();
     // az install soran nem form submit reven hivodik a create - ezert initClassVars-ra nincs szukseg:
     if (!$fromInstall) {
         $this->initClassVars();
         LocationHistory::savePost($this);
     }
     $condition = array();
     if ($word = @quoteSQL($this->str)) {
         if ($cid) {
             $condition[] = "(" . implode(" OR ", $this->getSimpleCustomFieldConditions($word, $cid)) . ")";
         } elseif ($simpleCond = $this->makeSearchQuerySimple()) {
             $condition[] = $simpleCond;
         }
     }
     $condition = array_merge($condition, $this->getAdvancedCustomFieldConditions($fields));
     if ($cid) {
         list($recursive, $wholeName) = G::getAttr($cid, "appcategory", "recursive", "wholeName");
         $cidCond = $recursive ? "wholeName LIKE '" . quoteSQL($wholeName) . "%'" : "cid='" . quoteSQL($cid) . "'";
     } else {
         $cidCond = "";
     }
     if ($this->relationBetweenFields == search_allFields) {
         if ($cid) {
             $condition[] = $cidCond;
         }
         return implode(" AND ", $condition);
     } elseif (count($condition)) {
         if ($cid) {
             return "({$cidCond} AND (" . implode(" OR ", $condition) . "))";
         } else {
             return "(" . implode(" OR ", $condition) . ")";
         }
     } else {
         return $cidCond;
     }
 }