type = self::TYPE_ADDONS;
$this->viewType = self::VIEW_TYPE_THUMB;
$this->init();
UniteProviderFunctionsUC::doAction(UniteCreatorFilters::ACTION_MODIFY_ADDONS_MANAGER, $this);
}
/**
* set filter addon type to use only it
*/
public function setAddonType($addonType, $typeTitle){
$this->filterAddonType = $addonType;
$this->addonTypeTitle = $typeTitle;
}
/**
* get addon admin html add
*/
protected function getAddonAdminAddHtml(UniteCreatorAddon $objAddon){
$addHtml = "";
$addHtml = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_MANAGER_ADDON_ADDHTML, $addHtml, $objAddon);
return($addHtml);
}
/**
* get html addon
*/
public function getAddonAdminHtml(UniteCreatorAddon $objAddon){
$objAddon->validateInited();
$title = $objAddon->getTitle(true);
$name = $objAddon->getNameByType();
$name = htmlspecialchars($name);
$description = $objAddon->getDescription(true);
//set html icon
$urlIcon = $objAddon->getUrlIcon();
//get preview html
$urlPreview = $objAddon->getUrlPreview();
$htmlPreview = "";
if($this->showAddonTooltip === true && !empty($urlPreview)){
$urlPreviewHtml = htmlspecialchars($urlPreview);
$htmlPreview = "data-preview='$urlPreviewHtml'";
}
$itemID = $objAddon->getID();
$descOutput = $description;
$class = "";
$isActive = $objAddon->getIsActive();
if($isActive == false)
$class = " class=\"uc-item-notactive\"";
$addHtml = $this->getAddonAdminAddHtml($objAddon);
//set html output
$htmlItem = "
";
IF($this->viewType == self::VIEW_TYPE_INFO){
$htmlItem .= " {$title}
";
$htmlItem .= " {$descOutput}
";
$htmlItem .= " ";
//add icon
$htmlIcon = "";
if(!empty($urlIcon))
$htmlIcon = "";
$htmlItem .= $htmlIcon;
}elseif($this->viewType == self::VIEW_TYPE_THUMB){
$classThumb = "";
$style = "";
if(empty($urlPreview))
$classThumb = " uc-no-thumb";
else{
$style = "style=\"background-image:url('{$urlPreview}')\"";
}
$htmlItem .= " ";
$htmlItem .= " {$title}
";
if($addHtml)
$htmlItem .= $addHtml;
}else{
UniteFunctionsUC::throwError("Wrong addons view type");
}
$htmlItem .= "";
return($htmlItem);
}
/**
* get single item menu
*/
protected function getMenuSingleItem(){
$arrMenuItem = array();
$arrMenuItem["edit_addon"] = __("Edit Addon",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem["edit_addon_blank"] = __("Edit In New Tab",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem["quick_edit"] = __("Quick Edit",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem["remove_item"] = __("Delete",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem["test_addon"] = __("Test Addon",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem["test_addon_blank"] = __("Test In New Tab",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem["export_addon"] = __("Export Addon",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItem = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_MANAGER_MENU_SINGLE, $arrMenuItem);
return($arrMenuItem);
}
/**
* get item field menu
*/
protected function getMenuField(){
$arrMenuField = array();
$arrMenuField["select_all"] = __("Select All",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuField = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_MANAGER_MENU_FIELD, $arrMenuField);
return($arrMenuField);
}
/**
* get multiple items menu
*/
protected function getMenuMulitipleItems(){
$arrMenuItemMultiple = array();
$arrMenuItemMultiple["remove_item"] = __("Delete",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuItemMultiple = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_MANAGER_MENU_MULTIPLE, $arrMenuItemMultiple);
return($arrMenuItemMultiple);
}
/**
* get category menu
*/
protected function getMenuCategory(){
$arrMenuCat = array();
$arrMenuCat["edit_category"] = __("Edit Category",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuCat["delete_category"] = __("Delete Category",ADDONLIBRARY_TEXTDOMAIN);
$arrMenuCat = UniteProviderFunctionsUC::applyFilters(UniteCreatorFilters::FILTER_MANAGER_MENU_CATEGORY, $arrMenuCat);
return($arrMenuCat);
}
/**
* get category list
*/
protected function getCatList(){
$htmlCatList = $this->objCats->getHtmlCatList(null, $this->filterAddonType);
return($htmlCatList);
}
/**
* get no items text
*/
protected function getNoItemsText(){
$text = __("No Addons Found", ADDONLIBRARY_TEXTDOMAIN);
return($text);
}
/**
* get html categories select
*/
protected function getHtmlSelectCats(){
if($this->hasCats == false)
UniteFunctionsUC::throwError("the function ");
$htmlSelectCats = $this->objCats->getHtmlSelectCats($this->filterAddonType);
return($htmlSelectCats);
}
/**
* put content to items wrapper div
*/
protected function putListWrapperContent(){
$addonType = $this->filterAddonType;
if(empty($addonType))
$addonType = "default";
$filepathEmptyAddons = GlobalsUC::$pathProviderViews."empty_addons_text_{$addonType}.php";
if(file_exists($filepathEmptyAddons) == false)
return(false);
?>
" data-textunselect="">
filterActive;
if(empty($filter))
$filter = "all";
?>
filterAddonType)){
$dialogTitle .= __(" for ",ADDONLIBRARY_TEXTDOMAIN);
$dialogTitle .= $this->addonTypeTitle;
}
$nonce = "";
if(method_exists("UniteProviderFunctionsUC", "getNonce"))
$nonce = UniteProviderFunctionsUC::getNonce();
?>
selectedCategory}\";
var managerAdmin = new UCManagerAdmin();";
if(!empty($arrPlugins)){
foreach($arrPlugins as $plugin)
$script .= "\n managerAdmin.addPlugin('{$plugin}');";
}
$script .= "
managerAdmin.initManager(selectedCatID);
});
";
UniteProviderFunctionsUC::printCustomScript($script);
}
/**
* put preview tooltips
*/
protected function putPreviewTooltips(){
?>
putDialogQuickEdit();
$this->putDialogAddAddon();
$this->putDialogImportAddons();
if($this->showAddonTooltip)
$this->putPreviewTooltips();
$this->putScripts();
}
/**
* put init items
*/
protected function putInitItems(){
if($this->hasCats == true)
return(false);
$objAddons = new UniteCreatorAddons();
$htmlAddons = $objAddons->getCatAddonsHtml(null, $this->filterActive);
echo $htmlAddons;
}
/**
*
* set the custom data to manager wrapper div
*/
protected function onBeforePutHtml(){
$addonsType = $this->filterAddonType;
$addHTML = "data-addonstype=\"{$addonsType}\"";
$this->setManagerAddHtml($addHTML);
}
/**
* init the addons manager
*/
protected function init(){
$this->hasCats = true;
parent::init();
$this->itemsLoaderText = __("Getting Addons",ADDONLIBRARY_TEXTDOMAIN);
$this->textItemsSelected = __("addons selected",ADDONLIBRARY_TEXTDOMAIN);
$this->filterActive = UniteCreatorAddons::getStateFilterActive();
//set selected category
$lastCatID = HelperUC::getState(UniteCreatorAddons::STATE_LAST_ADDONS_CATEGORY);
if(!empty($lastCatID))
$this->selectedCategory = $lastCatID;
}
}