Example #1
0
 /**
  * Constructor. Binds the model's database table to the object.
  *
  * @param bool|int|string|array $id Set this ID for this model on startup,
  * can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  * @see Model::__construct()
  * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $pluginDir = APP . 'Plugin' . DS . $this->plugin . DS . WEBROOT_DIR . DS . 'img' . DS;
     //カテゴリ間の区切り線
     $dir = new Folder($pluginDir . 'line');
     $files = $dir->find('.*\\..*');
     $files = Hash::sort($files, '{n}', 'asc');
     self::$categorySeparators = array(array('key' => null, 'name' => __d('links', '(no line)'), 'style' => null), array('key' => self::CATEGORY_SEPARATOR_DEFAULT, 'name' => '', 'style' => ''));
     foreach ($files as $file) {
         $info = getimagesize($dir->pwd() . DS . $file);
         $img = '/' . Inflector::underscore($this->plugin) . DS . 'img' . DS . 'line' . DS . $file;
         self::$categorySeparators[] = array('key' => $file, 'name' => '', 'style' => 'background-image: url(' . $img . '); ' . 'border-image: url(' . $img . '); ' . 'height: ' . $info[1] . 'px;');
     }
     unset($dir);
     //線スタイル
     $dir = new Folder($pluginDir . 'mark');
     $files = $dir->find('.*\\..*');
     $files = Hash::sort($files, '{n}', 'asc');
     self::$listStyles = array(array('key' => null, 'name' => '', 'style' => 'list-style-type: ' . self::LINE_STYLE_NONE . ';'), array('key' => self::LINE_STYLE_DISC, 'name' => '', 'style' => 'list-style-type: ' . self::LINE_STYLE_DISC . ';'), array('key' => self::LINE_STYLE_CIRCLE, 'name' => '', 'style' => 'list-style-type: ' . self::LINE_STYLE_CIRCLE . ';'), array('key' => self::LINE_STYLE_LOWER_ALPHA, 'name' => '', 'style' => 'list-style-type: ' . self::LINE_STYLE_LOWER_ALPHA . ';'), array('key' => self::LINE_STYLE_UPPER_ALPHA, 'name' => '', 'style' => 'list-style-type: ' . self::LINE_STYLE_UPPER_ALPHA . ';'));
     foreach ($files as $file) {
         $info = getimagesize($dir->pwd() . DS . $file);
         $img = '/' . Inflector::underscore($this->plugin) . DS . 'img' . DS . 'mark' . DS . $file;
         self::$listStyles[] = array('key' => $file, 'name' => '', 'style' => 'list-style-type: none; ' . 'list-style-image: url(' . $img . '); ');
     }
     unset($dir);
 }