示例#1
0
 private function seriesFill()
 {
     if (self::DATA_TYPE_NAMED === $this->dataType) {
         $this->rows = Processor::create($this->rows)->combineOffset(2, 1);
     }
     foreach ($this->rows as $row) {
         $xValue = array_shift($row);
         foreach ($row as $key => $value) {
             $this->highCharts->addRow($xValue, $value, $key);
         }
     }
 }
示例#2
0
 public function performAction()
 {
     $album = Album::findByPrimaryKey($this->albumId);
     if (!$album) {
         throw new \Exception('Album not found');
     }
     $images = Image::statement()->where('? = ?', Image::columns()->albumId, $this->albumId)->query()->fetchAll();
     if ($images) {
         $this->response->addContent(new Rows(Processor::create($images)->map(function (Image $image) {
             $row = array();
             $row['Path'] = $image->path;
             $row['Url'] = $image->url;
             return $row;
         })));
     }
     $uploadHandler = Upload::createState();
     $uploadHandler->albumId = $this->albumId;
     $uploadUrl = (string) $this->io->makeAnchor($uploadHandler);
     $this->response->addContent(new Form($uploadUrl));
 }
示例#3
0
 public function performAction()
 {
     if (!($user = AuthService::getInstance()->getUser())) {
         throw new \Exception('Authenticated user required');
     }
     $this->response->success('CATALOGE!');
     /** @var Album[] $albums */
     $albums = Album::statement()->where('? = ?', Album::columns()->userId, $user->id)->query()->fetchAll();
     $this->response->addContent(new Form(Create::createState(), $this->io));
     $details = Details::createState();
     if ($albums) {
         $this->response->addContent(new Rows(Processor::create($albums)->map(function (Album $album) use($details) {
             $row = array();
             $details->albumId = $album->id;
             $anchor = $this->io->makeAnchor($details);
             $row['Title'] = new Anchor($album->title, $anchor);
             $row['Created'] = date('Y-m-d H:i:s', $album->created);
             $row['Updated'] = date('Y-m-d H:i:s', $album->updated);
             $row['Images'] = $album->imagesCount;
             return $row;
         })));
     }
 }