Example #1
0
 public function testGetURI()
 {
     global $config;
     $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithCustomColumns/";
     $_GET["custom"] = "11";
     $config['cops_calibre_custom_column'] = array("custom_01", "custom_02", "custom_03", "custom_04", "custom_05", "custom_06", "custom_07", "custom_08", "custom_09", "custom_10", "custom_11");
     Base::clearDb();
     $custom = CustomColumnType::createByLookup("custom_01")->getCustom("1");
     $this->assertEquals($custom->customColumnType->getQuery("1"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_02")->getCustom("3");
     $this->assertEquals($custom->customColumnType->getQuery("3"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_03")->getCustom("3");
     $this->assertEquals($custom->customColumnType->getQuery("3"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_04")->getCustom("4");
     $this->assertEquals($custom->customColumnType->getQuery("4"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_05")->getCustom("6");
     $this->assertEquals($custom->customColumnType->getQuery("6"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_06")->getCustom("2016-04-24");
     $this->assertEquals($custom->customColumnType->getQuery("2016-04-24"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_07")->getCustom("11.0");
     $this->assertEquals($custom->customColumnType->getQuery("11.0"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_08")->getCustom("-2");
     $this->assertEquals($custom->customColumnType->getQuery("-2"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_09")->getCustom("0");
     $this->assertEquals($custom->customColumnType->getQuery("0"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_09")->getCustom("1");
     $this->assertEquals($custom->customColumnType->getQuery("1"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_10")->getCustom("-1");
     $this->assertEquals($custom->customColumnType->getQuery("-1"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_10")->getCustom("0");
     $this->assertEquals($custom->customColumnType->getQuery("0"), $custom->getQuery());
     $custom = CustomColumnType::createByLookup("custom_10")->getCustom("1");
     $this->assertEquals($custom->customColumnType->getQuery("1"), $custom->getQuery());
     $_GET["custom"] = NULL;
     $config['cops_calibre_custom_column'] = array();
     $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithSomeBooks/";
     Base::clearDb();
 }
Example #2
0
 public function InitializeContent()
 {
     $customId = getURLParam("custom", NULL);
     $columnType = CustomColumnType::createByCustomID($customId);
     $this->title = $columnType->getTitle();
     $this->entryArray = $columnType->getAllCustomValues();
     $this->idPage = $columnType->getAllCustomsId();
 }
Example #3
0
 protected function __construct($pcustomId)
 {
     parent::__construct($pcustomId, self::CUSTOM_TYPE_COMMENT);
 }
Example #4
0
 /**
  * The values of all the specified columns
  *
  * @param string[] $columns
  * @return CustomColumn[]
  */
 public function getCustomColumnValues($columns, $asArray = false)
 {
     $result = array();
     foreach ($columns as $lookup) {
         $col = CustomColumnType::createByLookup($lookup);
         if (!is_null($col)) {
             $cust = $col->getCustomByBook($this);
             if (!is_null($cust)) {
                 if ($asArray) {
                     array_push($result, $cust->toArray());
                 } else {
                     array_push($result, $cust);
                 }
             }
         }
     }
     return $result;
 }