public function getImage($name, $base = false) { if (file_exists(Core_Model_Directory::getDesignPath(true) . '/images/' . $name)) { return Core_Model_Directory::getDesignPath($base) . '/images/' . $name; } else { if (file_exists(Media_Model_Library_Image::getBaseImagePathTo($name))) { return $base ? Media_Model_Library_Image::getBaseImagePathTo($name) : Media_Model_Library_Image::getImagePathTo($name); } } return ""; }
public function getBaseImagePath() { return Core_Model_Directory::getDesignPath(true) . '/images'; }
public function isActive() { return $this->getData("is_active"); return $this->getId() <= 7 || file_exists(Core_Model_Directory::getDesignPath(true, "template/home/l{$this->getId()}/view.phtml", "mobile")); }
/** * @todo Ajouter le addLayout * * @return type */ protected function _createXml($use_base) { // Définition des variables $action = $this->_action; $module = current(explode('_', $action)); $filename = $module . '.xml'; $this->_otherLayout = array(); $keys = array(); if ($use_base) { $this->_baseDefaultLayout = simplexml_load_file(Core_Model_Directory::getDesignPath(true) . '/layout/front.xml', null, LIBXML_COMPACT); $this->_defaultLayout = $this->_baseDefaultLayout->default; } if ($use_base and isset($this->_baseDefaultLayout->{$action})) { $this->_actionLayout = $this->_baseDefaultLayout->{$action}; } elseif (file_exists(Core_Model_Directory::getDesignPath(true) . '/layout/' . $filename)) { $this->_baseActionLayout = simplexml_load_file(Core_Model_Directory::getDesignPath(true) . '/layout/' . $filename); $this->_actionLayout = $this->_baseActionLayout->{$action}; } else { return $this->_defaultLayout; } // // Récupère tous les keepOnly // $allowedKeys = array(); // $path = '/layout/'.$action.'/keepOnly'; // $datas = $this->_actionLayout->xpath($path); // foreach($datas as $key => $data) { // $allowedKeys[] = (string) $data->attributes()->name; // } // $datas = $this->_defaultLayout->xpath($path); // foreach($datas as $key => $data) { // $allowedKeys[] = (string) $data->attributes()->name; // } // Récupération des noms des balises $nodes = array($action => $this->_actionLayout, 'default' => $this->_defaultLayout); $path = '/layout/' . $action . '/addLayout'; $datas = $this->_actionLayout->xpath($path); foreach ($datas as $data) { $name = (string) $data->attributes()->name; if (isset($this->_baseActionLayout->{$name})) { $nodes[$name] = $this->_otherLayout[$name] = $this->_baseActionLayout->{$name}; } elseif (isset($this->_baseDefaultLayout->{$name})) { $nodes[$name] = $this->_otherLayout[$name] = $this->_baseDefaultLayout->{$name}; } } if ($use_base) { $path = '/layout/default/addLayout'; $datas = $this->_baseDefaultLayout->xpath($path); foreach ($datas as $data) { $name = (string) $data->attributes()->name; if (isset($this->_baseDefaultLayout->{$name})) { $nodes[$name] = $this->_otherLayout[$name] = $this->_baseDefaultLayout->{$name}; } } } $path = '/layout/' . $action . '/removeLayout'; $datas = $this->_actionLayout->xpath($path); foreach ($datas as $data) { $name = (string) $data->attributes()->name; if (isset($nodes['default']->views->{$name})) { unset($nodes['default']->views->{$name}); } } if ($use_base) { $path = '/layout/default/removeLayout'; $datas = $this->_baseDefaultLayout->xpath($path); foreach ($datas as $data) { $name = (string) $data->attributes()->name; if (isset($nodes['default']->views->{$name})) { unset($nodes['default']->views->{$name}); } } } // $path = '/layout/'.$action.'/keepOnly'; // $datas = $this->_actionLayout->xpath($path); // foreach($datas as $key => $data) { // $name = (string) $data->attributes()->name; //// Zend_Debug::dump($nodes); // // // if(isset($nodes['default']->views->$name)) { // unset($nodes['default']->views->$name); // } // } foreach ($nodes as $node) { if (empty($node)) { continue; } $children = $node->children(); foreach ($children as $key => $child) { if (!in_array($key, $keys)) { $keys[] = $key; } } } // Fusion des différents XML foreach ($keys as $key) { // if(!empty($allowedKeys) AND !in_array($key, $allowedKeys)) continue; switch ($key) { case "base": if ($use_base) { $this->_process($key, $use_base); } break; case "views": case "layout": case "layout_col-left": case "layout_col-right": $this->_process($key, $use_base); break; case "actions": case "classes": $this->_process($key, $use_base, true); break; case "addLayout": default: break; } } return $this->_xml; }
public function getAllPictos() { $picto_urls = array(); foreach ($this->getBlocks() as $block) { $dir = Core_Model_Directory::getDesignPath(true, "/images/pictos/", "mobile"); $pictos = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, 4096), RecursiveIteratorIterator::SELF_FIRST); foreach ($pictos as $picto) { $colorized_color = Core_Model_Lib_Image::getColorizedUrl($picto->getPathName(), $block->getColor()); $colorized_background_color = Core_Model_Lib_Image::getColorizedUrl($picto->getPathName(), $block->getBackgroundColor()); $picto_urls[$colorized_color] = $colorized_color; $picto_urls[$colorized_background_color] = $colorized_background_color; } } return $picto_urls; }