コード例 #1
0
ファイル: Foto.php プロジェクト: jager/cms
 public function upload($aData = array())
 {
     if (!$aData or sizeof($aData) == 0) {
         throw new Exception("No data sent!");
     }
     $file = $this->transfer($this->_tmpPath);
     if (!$file instanceof Zend_File_Transfer_Adapter_Http) {
         throw new Exception($file);
     }
     $source = $file->getFileName('file');
     $name = $file->getFileName('file', false);
     $fileHandler = $this->setHandler($file->getMimeType('file'), $source, $aData['GALERY']);
     $aFotos = $fileHandler->getFiles();
     if ($aData['GALERY'] > 0 and sizeof($aFotos) > 0) {
         foreach ($aFotos as $fotoName) {
             $this->Galeries_id = $aData['GALERY'];
             $galery = Galery::getById($aData['GALERY']);
             $this->sourcename = $fotoName;
             $this->added = date('Y-m-d H:i:s', time());
             if ($galery->tournament_id) {
                 $this->Tournaments_id = $galery->tournament_id;
             }
             $this->save();
         }
     }
 }
コード例 #2
0
ファイル: navigation.php プロジェクト: ArvenAnna/MyProgs
function navigation($form_action, $items, $pages)
{
    $pagescount = $pages + 1;
    $gal = new Galery($items);
    if ($_REQUEST['help']) {
        $gal->set_previous_page($_REQUEST['help']);
    }
    $i = 0;
    while ($i < $pagescount) {
        if ($_REQUEST["flower{$i}"]) {
            $gal->set_current_page($i, $items);
        }
        $i++;
    }
    if ($_REQUEST['back']) {
        $gal->back($items);
    }
    if ($_REQUEST['forward']) {
        $gal->forward($items);
    }
    echo $gal->content;
    echo "<form action={$form_action} name='navigation'><input type='hidden' name='help' value={$gal->current_page}></input>";
    if ($gal->current_page != 0) {
        echo "<input type='submit' name='back' value='Назад'></input>";
    }
    $i = 0;
    while ($i < $pagescount) {
        echo "<input type='submit' name='flower" . $i . "' value='" . ($i + 1) . "'></input>";
        $i++;
    }
    if ($gal->current_page != $pages) {
        echo "<input type='submit' name='forward' value='Вперед'></input>";
    }
    echo "</form>";
    echo "Это вставить где надо - текущая страница " . ($gal->current_page + 1);
}
コード例 #3
0
ファイル: GaleryController.php プロジェクト: jager/cms
 public function indexAction()
 {
     $this->view->aGaleries = Galery::findList()->where("publishtype = 'g'")->orderby('id desc')->execute();
 }