/** * Craete an CustomColumn by CustomColumnID and ValueID * * @param integer $customId the id of the customColumn * @param integer $id the id of the chosen value * @return CustomColumn|null */ public static function createCustom($customId, $id) { $columnType = CustomColumnType::createByCustomID($customId); return $columnType->getCustom($id); }
public function testIndexType10() { global $config; $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithCustomColumns/"; $config['cops_calibre_custom_column'] = array("custom_10"); Base::clearDb(); $currentPage = Page::getPage(Base::PAGE_INDEX, NULL, NULL, "1"); $currentPage->InitializeContent(); $this->assertCount(7, $currentPage->entryArray); // Authors, Series, Publishers, Languages, custom, All, Recent $this->assertEquals("custom_10", $currentPage->entryArray[4]->title); $this->assertEquals("cops:custom:11", $currentPage->entryArray[4]->id); $this->assertEquals("Index of a boolean value", $currentPage->entryArray[4]->content); $this->assertEquals(3, $currentPage->entryArray[4]->numberOfElement); $this->assertEquals("bool", $currentPage->entryArray[4]->contentType); $this->assertEquals($currentPage->entryArray[4], CustomColumnType::createByCustomID(11)->getCount()); $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithSomeBooks/"; $config['cops_calibre_custom_column'] = array(); Base::clearDb(); }
public function InitializeContent() { $customId = getURLParam("custom", NULL); $columnType = CustomColumnType::createByCustomID($customId); $this->title = $columnType->getTitle(); $this->entryArray = $columnType->getAllCustomValues(); $this->idPage = $columnType->getAllCustomsId(); }