return $url;
}
- // public function importEn() {
- // $import = new CubeIT_Translate_Import_Excel('fr', 'en');
- // $import->import(PUBLIC_PATH . '/translations_en.xlsx');
- // Bootstrap::getInstance()->getCache()->clean();
- // }
+// public function featuredCategories() {
+// $references = Fluidbook_Model_Reference::factory()->find();
+// foreach ($references as $reference) {
+// if ($reference->getFeatured()) {
+// $reference->setFeaturedCategories($reference->getCategories());
+// }
+// fb($reference->toArray());
+// $reference->save();
+// }
+// }
public function importReferences() {
set_time_limit(0);
$categories->setLabel('Catégories');\r
$this->addElement($categories);\r
\r
- $featured = new Zend_Form_Element_Checkbox('featured');\r
- $featured->setLabel('Mis en avant');\r
- $this->addElement($featured);\r
+ $categories = new Fluidbook_Form_CMS_Element_Exemple_Categories('featured_categories');\r
+ $categories->setLabel('Mise en avant');\r
+ $this->addElement($categories);\r
\r
$homeimage = new CubeIT_Form_Element_File_Image('homeimage');\r
$homeimage->setLabel('Image pour la page d\'accueil');\r
protected $fluidbook_id;\r
protected $fluidbook_page;\r
protected $image;\r
- protected $featured;\r
protected $categories;\r
+ protected $featured_categories;\r
protected $homeimage;\r
\r
protected $_types = array('categories' => 'list', 'title' => 'json', 'text' => 'json', 'image' => 'json', 'homeimage' => 'json', 'fluidbook_id' => 'json', 'fluidbook_page' => 'json');\r
$table->addColumn('image', 'string', array('length' => 64));\r
$table->addColumn('homeimage', 'string', array('length' => 64));\r
$table->addColumn('categories', 'string', array('length' => 64));\r
+ $table->addColumn('featured_categories', 'string', array('length' => 64));\r
return $table;\r
}\r
\r
- public function getFinalFluidbookId() {\r
+ public function getFluidbookId() {\r
$res = parent::getFluidbookId();\r
return $this->_setFrDefault($res);\r
}\r
\r
protected function _setFrDefault($res) {\r
+\r
if (CubeIT_Util_Json::isJson($res)) {\r
$res = CubeIT_Util_Json::decode($res);\r
}\r
+\r
if (!is_array($res) && !is_object($res)) {\r
return $res;\r
}\r
+ $res = CubeIT_Util_Object::asObject($res);\r
+\r
if (!$res->en) {\r
$res->en = $res->fr;\r
}\r
return $url;\r
}\r
if (null === $locale) {\r
- return $this->_getLocalReference($this->getFinalFluidbookId());\r
+ return $this->_getLocalReference($this->getFluidbookId());\r
} else {\r
- return $this->_getLocalReference($this->getFinalFluidbookId()->$locale);\r
+ return $this->_getLocalReference($this->getFluidbookId()->$locale);\r
}\r
}\r
\r
return '/references/' . $d . '/';\r
}\r
\r
- public function getFinalFluidbookPage() {\r
+ public function getFluidbookPage() {\r
$res = parent::getFluidbookPage();\r
return $this->_setFrDefault($res);\r
}\r
}\r
\r
$res->fr = $this->_getFinalURL($res->fr, 'fr');\r
- $res->fr = $this->_getFinalURL($res->en, 'en');\r
+ $res->en = $this->_getFinalURL($res->en, 'en');\r
\r
return $res;\r
}\r
$okexemples = array();\r
\r
foreach ($exemples as $id => $exemple) {\r
- if ($category > 0 && !in_array($category, $exemple->getCategories())) {\r
+ if ($category > 0 && !in_array($category, $exemple->getCategories()) && !in_array($category, $exemple->getFeaturedCategories())) {\r
continue;\r
}\r
$okexemples[$id] = $exemple;\r
$max_normal = $max_featured * $normal_per_featured;\r
\r
foreach ($okexemples as $id => $exemple) {\r
- if ($exemple->getFeatured()) {\r
+ if (in_array($category, $exemple->getFeaturedCategories())) {\r
$featured[] = $id;\r
} else {\r
$normal[] = $id;\r
\r
$image = CubeIT_Util_Cms::extractFile($f->getImage());\r
\r
- if (!$image && $f->getFinalFluidbookId()) {\r
- $res .= $this->exemplePublication($f->getFinalFluidbookId(), $f->getFinalFluidbookPage());\r
+\r
+ if (!$image && $f->getFluidbookId()) {\r
+ $res .= $this->exemplePublication($f->getFluidbookId(), $f->getFluidbookPage());\r
} else {\r
$res .= $this->htmlElement('', 'div',\r
array('style' => 'background-image:url(' . $this->imageProcess()->imageProcessGetURL($image, $f->getTitle() . ' - ' . $f->getText(), 660, 440, array(), 'R') . ');',\r