SCHLIX\cmsApplication_HierarchicalTree_List

Inherited from cmsApplication_CategorizedList
Implements interface_cmsApplication_HierarchicalTree_List
Inherits Contacts, Core_ExtGallery, Core_MediaManager, Gallery, Html, cmsApplication_ManyToMany

Protected Attributes

protected $mode 
protected $field_category_parent_id 
protected $view_template_category_file= 'view.category.nested'

Public Methods

public __construct($app_description, $table_items, $table_categories)
public intgetDefaultCategoryID()
Return the default category ID for save item operation. Returns 0 in this class @global \SCHLIX\cmsDatabase $SystemDB
public stringgetFieldCategoryParentID()
return Category's Parent ID field name
public getTotalChildCategoryCountByCategoryID($parent_cid, $criteria='', $cache=false)
public getBreadCrumbsByCategoryID($cat_id)
public getBreadCrumbsByItemID($item_id)
public stringgetFullPathByItemID(int $item_id)
Returns the path given item ID. e.g. /folder1/folder2/item.html @global \SCHLIX\cmsDatabase $SystemDB
public stringgetFullPathByCategoryID(int $cat_id)
Returns the full path with trailing slash of current category. e.g. /folder1/folder2/
public getChildCategoriesByParentID($id, $fields=' *', $extra_criteria='', $start, $end, $sortby='', $sortdirection='ASC', $from_cache=false)
public arraygetAllParentsByCategoryID(int $category_id)
Returns an array of all parent categories for this category
public getChildCategoriesByParentIDWithChildCount($id, $fields=' *', $extra_criteria='', $start, $end, $sortby='', $sortdirection='ASC', $from_cache=false)
public booleanviewCategoryByID(int $id=1, int $pg=1, string $sortby='', string $sortdirection='ASC', bool $from_cache=false, string $standard_criteria='status, )
View Category By ID
public traverseCategories($catid)
public arraygetCategoryMetaOptionKeys()
Returns an array containing on array of category options. The values of the options will still be evaluated as a flat list array, however it is sectioned into array with the following keys: header, value, type, and options. Label: section title (not used for any evaluation Type: checkboxgroup, dropdownlist, or none. If none, then it means there are suboptions which contain another array of this Key: the key option. Please note that checkboxgroup doesn't have a key since the keys are in the options Options: an array with 2 keys: label and key Label: section title (not used for any evaluation Type: checkboxgroup, dropdownlist, or none. If none, then it means there are suboptions which contain another array of this Key: the key option. Please note that checkboxgroup doesn't have a key since the keys are in the options Options: an array with 2 keys: label and key
public stringpreventDuplicateValueInCategoryTableUnderParentCategory(string $fieldname, string $possible_duplicate, int $cid, int $parent_id)
Returns a new name if there's an item with the same name in the specified $fieldname @global \SCHLIX\cmsDatabase $SystemDB
public deleteCategoryByID(int $cid)
Delete category by ID, recursive @global \App\Users $CurrentUser
public arraygetMainpageMetaOptionKeys()
Delete objects. Parameter $mixed_items_to_delete is a category/item comma separated values e.g. c5,c6,c9,i4,i14 @global \SCHLIX\cmsDatabase $SystemDB @param string $mixed_items_to_delete function delete($mixed_items_to_delete) { // mixed item = categories + items test case: http://schlixcms/admin/index.php?page=html&ajax=1&action=ajax_delete&items=c3 http://schlixcms/admin/index.php?page=html&ajax=1&action=ajax_delete&items=c5,c6,c9,i4,i14 global $SystemDB; $id = 1; $mixed_items_array = explode('|', $mixed_items_to_delete); // e.g: c5,c6,c9,i4,i14 $cats_to_delete = NULL; $all_cats_to_delete = NULL; Process sub-folders first foreach ($mixed_items_array as $mixed_item) { $current_id = substr($mixed_item, 1); // 11 is the next string after if (strpos($mixed_item, 'c') > -1) { Get the sub-child for each cats $cats_to_delete = $this->traverseCategories($current_id); Now Process if ($all_cats_to_delete) $all_cats_to_delete = array_merge($all_cats_to_delete, $cats_to_delete); else $all_cats_to_delete = $cats_to_delete; } else { // else if it's an item instead $items_to_delete[] = (int) $current_id; } } Process files if ($all_cats_to_delete) { foreach ($all_cats_to_delete as $a_cat_to_delete) $cat_id_filler_for_sql[] = $a_cat_to_delete[$this->field_category_id]; $result_array_items_in_these_categories = $this->getAllChildItemsInMultipleCategories($cat_id_filler_for_sql); } Did the user select any items to delete? if ($items_to_delete) { if ($result_array_items_in_these_categories) $items_to_delete = array_merge($items_to_delete, $result_array_items_in_these_categories); } else $items_to_delete = $result_array_items_in_these_categories; now delete all of them - $all_cats_to_delete + $items_to_delete if ($items_to_delete) $items_to_delete_str = implode(",", $items_to_delete); if ($cat_id_filler_for_sql) $cats_to_delete_str = implode(",", $cat_id_filler_for_sql); if ($items_to_delete_str) { $items_to_delete_str = implode(",", $items_to_delete); $sql1 = "DELETE FROM {$this->table_items} WHERE {$this->field_id} in ({$items_to_delete_str})"; $SystemDB->query($sql1); } if ($cats_to_delete_str) { $cats_to_delete_str = implode(",", $cat_id_filler_for_sql); $sql2 = "DELETE FROM {$this->table_categories} WHERE {$this->field_category_id} in ({$cats_to_delete_str})"; $SystemDB->query($sql2); } } Returns an array containing on array of main page options. The values of the options will still be evaluated as a flat list array, however it is sectioned into array with the following keys: header, value, type, and options. Label: section title (not used for any evaluation Type: checkboxgroup, dropdownlist, or none. If none, then it means there are suboptions which contain another array of this Key: the key option. Please note that checkboxgroup doesn't have a key since the keys are in the options Options: an array with 2 keys: label and key Label: section title (not used for any evaluation Type: checkboxgroup, dropdownlist, or none. If none, then it means there are suboptions which contain another array of this Key: the key option. Please note that checkboxgroup doesn't have a key since the keys are in the options Options: an array with 2 keys: label and key