public function loadModel($id)
 {
     $model = Portfolio::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 2
0
 public function actionDelete($id)
 {
     $user = User::model()->findByPk((int) $id);
     //delete all portfolio of specified company
     $criteria = new CDbCriteria();
     $idcompany = (int) $user->company->id;
     $criteria->condition = "company_id={$idcompany}";
     Portfolio::model()->deleteAll($criteria);
     // delelte company
     Company::model()->deleteByPk($idcompany);
     // delete user
     $user->delete();
 }
 public function actionIndex()
 {
     $type = Type::model()->findAll();
     $skill = Skill::model()->findAll();
     $usr = User::model()->findbyPk(1);
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->order = 'rand()';
     $total = Portfolio::model()->count();
     $pages = new CPagination($total);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $port = Portfolio::model()->findAll($criteria);
     $this->render('index', array('type' => $type, 'port' => $port, 'pages' => $pages, 'skill' => $skill, 'usr' => $usr));
 }
Esempio n. 4
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->layout = 'index';
     // one page about
     $criteriaAbout = new CDbCriteria(array('condition' => "t.key='about'"));
     $about = Pages::model()->findAll($criteriaAbout);
     // one page features
     $criteriaFeatures = new CDbCriteria(array('condition' => "t.key='features'"));
     $features = Pages::model()->findAll($criteriaFeatures);
     // one page portfolio
     $criteriaPortfolio = new CDbCriteria(array('condition' => "t.active='1'"));
     $portfolio = Portfolio::model()->findAll($criteriaPortfolio);
     $this->render('index', array('about' => $about, 'features' => $features, 'portfolio' => $portfolio));
 }
 public function actionIndex()
 {
     $urls = array();
     // Actions
     $urls[] = $this->createUrl('actions/index');
     $actions = Actions::model()->findAll('t.picture != "" AND t.date_end <= ' . date('Y-m-d'));
     if (count($actions) > 0) {
         foreach ($actions as $action) {
             $urls[] = $this->createUrl('actions/view', array('id' => $action->id));
         }
     }
     // Tenders
     $urls[] = $this->createUrl('tenders/index');
     $tenders = Tenders::model()->findAll('t.date_end <= ' . date('Y-m-d'));
     if (count($tenders) > 0) {
         foreach ($tenders as $tender) {
             $urls[] = $this->createUrl('tenders/view', array('id' => $tender->id));
         }
     }
     // Freefoto
     $urls[] = $this->createUrl('freefoto/index');
     // Static Pages
     $urls[] = $this->createUrl('page/hmagent');
     $urls[] = $this->createUrl('page/advertisment');
     $urls[] = $this->createUrl('page/help_us');
     $urls[] = $this->createUrl('page/about');
     $urls[] = $this->createUrl('page/accounts');
     // News
     $urls[] = $this->createUrl('page/news');
     $news = News::model()->findAll('t.title != "" AND t.intro_text != ""');
     if (count($news) > 0) {
         foreach ($news as $item) {
             $urls[] = $this->createUrl('page/news', array('id' => $item->id));
         }
     }
     // Categories
     $cats = Occupation::model()->localized('ru')->findAll(array('condition' => 't.name!="" AND t.active=1', 'order' => 't.cat_id ASC'));
     if (count($cats) > 0) {
         foreach ($cats as $cat) {
             $urls[] = $this->createUrl('/cat/view', array('id' => 'c' . $cat->id . '_' . Settings::toLatin($cat->name)));
         }
     }
     // Users
     $users = Users::model()->findAll('t.name!="" AND t.activate=1');
     if (count($users) > 0) {
         foreach ($users as $user) {
             if ($user->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) {
                 $urls[] = '/id' . $user->id;
                 // Photo albums
                 if ($user->occupation_id == 1) {
                     $alb = Portfolio::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1));
                     if (count($alb) > 0) {
                         foreach ($alb as $item) {
                             if ($item->filesCount > 0) {
                                 $urls[] = $this->createUrl('user/album', array('id' => $item->id));
                             }
                         }
                     }
                 }
                 // Video albums
                 if ($user->occupation_id == 2) {
                     $vid = Video::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1));
                     if (count($vid) > 0) {
                         foreach ($vid as $item) {
                             if ($item->filesCount > 0) {
                                 $urls[] = $this->createUrl('user/videoalbum', array('id' => $item->id));
                             }
                         }
                     }
                 }
             }
         }
     }
     // Photo albums
     $users_alb = Users::model()->findAll('t.name!="" AND t.activate=1 AND t.occupation_id=1');
     if (count($users_alb) > 0) {
         foreach ($users_alb as $user_alb) {
             if ($user_alb->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) {
                 $urls[] = '/id' . $user->id;
             }
         }
     }
     /*// Страницы
             $pages = Page::model()->findAll(array(
                 'condition' => 't.public = 1';
             ));
             foreach ($posts as $page){
                 $urls[] = $this->createUrl('page/view', array('alias'=>$page->alias));
             }
      
             // Новости
             $news = News::model()->findAll(array(
                 'condition' => 't.public = 1';
             ));
             foreach ($news as $new){
                 $urls[] = $this->createUrl('news/view', array('id'=>$new->id));
             }
      
             // Работы портфолио
             $works = Work::model()->findAll(array(
                 'condition' => 't.public = 1';
             ));
             foreach ($works as $work){
                 $urls[] = $this->createUrl('work/view', array('id'=>$work->id));
             }
      
             // Товары
             $products = Product::model()->findAll(array(
                 'condition' => 't.public = 1 AND t.count > 0';
             ));
             foreach ($products as $product){
                 $urls[] = $this->createUrl('product/view', array('category'=>$product->category->alias, 'id'=>$product->id));
             }
      
             // ...*/
     $host = Yii::app()->request->hostInfo;
     echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     echo '<url>
             <loc>' . $host . '</loc>
             <changefreq>daily</changefreq>
             <priority>0.5</priority>
         </url>';
     if (count($urls) > 0) {
         foreach ($urls as $url) {
             echo '<url>
                 <loc>' . $host . $url . '</loc>
                 <changefreq>daily</changefreq>
                 <priority>0.5</priority>
             </url>';
         }
     }
     echo '</urlset>';
     Yii::app()->end();
 }
Esempio n. 6
0
          </div>
      </div>
      <div class="middle_photo">
          
          <div class="cur_photo">           
          <?php 
echo '<div id="content_photo">';
if ($next != '') {
    echo '<a href="' . parse_url(Yii::app()->request->requestUri, PHP_URL_PATH) . '?photo=photo' . $next . '" class="next_item">';
}
if (!is_file($_SERVER['DOCUMENT_ROOT'] . '/users/' . $user->id . '/940_' . $current)) {
    $ih = new CImageHandler();
    $ih->load($_SERVER['DOCUMENT_ROOT'] . '/users/' . $user->id . '/' . $current)->resize(940, 680)->save($_SERVER['DOCUMENT_ROOT'] . '/users/' . $user->id . '/940_' . $current);
    echo '<img src="/users/' . $user->id . '/940_' . $current . '" alt="' . $user->name . ' - Фотограф - ' . Portfolio::model()->findByPk(Yii::app()->getRequest()->getParam('id'))->title . '">';
} else {
    echo '<img src="/users/' . $user->id . '/940_' . $current . '" alt="' . $user->name . ' - Фотограф - ' . Portfolio::model()->findByPk(Yii::app()->getRequest()->getParam('id'))->title . '">';
}
if ($next != '') {
    echo '</a>';
}
echo '<a href="/users/' . $user->id . '/' . $current . '" class="gallery__zoom" rel="big" data-img="/users/' . $user->id . '/' . $current . '"></a>';
echo '</div>';
?>
          </div>
 
    </div>
   </div>
   
    <div id="big_gallery" style="display: none;">
    <?php 
foreach ($model as $item) {
 public function actionShowform($id)
 {
     $data = explode('_', $id);
     $pack = Prices::model()->findByAttributes(array('genre_id' => $data[0], 'package' => $data[1], 'user_id' => Yii::app()->user->id));
     if (Yii::app()->user->role == 2) {
         //videooperator
         $title = Video::model()->findByAttributes(array('uid' => Yii::app()->user->id, 'id' => $data[0]));
     } else {
         $title = Portfolio::model()->findByAttributes(array('uid' => Yii::app()->user->id, 'id' => $data[0]));
     }
     if (is_object($pack)) {
         $html = '<form action="/my/prices/update/id/' . $pack->id . '" method="post">';
         $html .= '<script>
             $(document).ready(function() {
                 $("#price__price").keydown(function (e) {
                     // Allow: backspace, delete, tab, escape, enter and .
                     if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110]) !== -1 ||
                          // Allow: Ctrl+A
                         (e.keyCode == 65 && e.ctrlKey === true) || 
                          // Allow: home, end, left, right, down, up
                         (e.keyCode >= 35 && e.keyCode <= 40)) {
                              return;
                     }
                     // Ensure that it is a number and stop the keypress
                     if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
                         e.preventDefault();
                     }
                 });
             });
             </script>';
         $html .= '<div class="tooltip_cost_title">' . $title->title . '</div>
                 <label for="albom__name" class="tool_label" style="margin-top: 25px;">Цена</label>
                     <input type="text" name="Prices[price]" value="' . $pack->price . '" id="price__price" class="default__input search__hidden__input--city" maxlength="7" title="Это поле обязательно для заполнение" placeholder="500 грн" required="">
                 <label for="albom__name" class="tool_label">Описание</label>
                     <textarea name="Prices[about]" id="about__user" cols="25" rows="10" class="default__textarea" placeholder="Описание услуги:">' . $pack->about . '</textarea>
                     
                     <div class="col-12 text_center" style="margin-top: 25px;">
                         <div class="btn__group clfx">
                             <div class="col-179">                  
                                 <button type="button" class="t-cls cabinet__profile__btn" id="close_tip" onclick="closeTip(\'' . $id . '\')">ОТМЕНА</button>                  
                             </div>                  
                             <div class="col-179">                    
                                 <input type="hidden" name="Prices[user_id]" value="' . Yii::app()->user->id . '" />
                                 <input type="hidden" name="Prices[package]" value="' . $data[1] . '" />
                                 <input type="hidden" name="Prices[genre_id]" value="' . $data[0] . '" />
                                 <button type="submit" class="t-cls cabinet__profile__btn cabinet__profile__btn-submit">СОХРАНИТЬ</button>
                             </div>                
                         </div>            
               </div>
               </form>';
     } else {
         $html = '<form action="/my/prices/create/" method="post">';
         $html .= '<div class="tooltip_cost_title">' . $title->title . '</div>
                 <label for="albom__name" class="tool_label" style="margin-top: 25px;">Цена</label>
                     <input type="text" name="Prices[price]" id="albom__name" class="default__input search__hidden__input--city" title="Это поле обязательно для заполнение" placeholder="500 грн" required="">
                 <label for="albom__name" class="tool_label">Описание</label>
                     <textarea name="Prices[about]" id="about__user" cols="25" rows="10" class="default__textarea" placeholder="Описание услуги:"></textarea>
                     
                     <div class="col-12 text_center" style="margin-top: 25px;">
                         <div class="btn__group clfx">
                             <div class="col-179">                  
                                 <button type="button" class="t-cls cabinet__profile__btn" id="close_tip" onclick="closeTip(\'' . $id . '\')">ОТМЕНА</button>                  
                             </div>                  
                             <div class="col-179">                    
                                 <input type="hidden" name="Prices[user_id]" value="' . Yii::app()->user->id . '" />
                                 <input type="hidden" name="Prices[package]" value="' . $data[1] . '" />
                                 <input type="hidden" name="Prices[genre_id]" value="' . $data[0] . '" />
                                 <button type="submit" class="t-cls cabinet__profile__btn cabinet__profile__btn-submit">СОХРАНИТЬ</button>
                             </div>                
                         </div>            
               </div>
               </form>';
     }
     echo $html;
 }
 public function actionUpdatefiles()
 {
     //print_r($_POST); print_r($_FILES); exit();
     if (isset($_POST)) {
         $err = false;
         if (!empty($_POST['Files'])) {
             foreach ($_POST['Files'] as $k => $item) {
                 $model = Files::model()->findByPk($item['id']);
                 if ($item['description'] != '') {
                     $model->description = $item['description'];
                 }
                 $model->source = 'portfolio';
                 if (!$model->save()) {
                     $err = true;
                 }
             }
         }
         if ($err == false) {
             if (!empty($_POST['cover'])) {
                 $cover = explode('__', $_POST['cover']);
                 Portfolio::model()->updateByPk($cover[0], array('picture' => $cover[1]));
                 //$this->redirect('/my/portfolio/album/id/'.$cover[0]);
                 $this->redirect($_POST['back']);
             } else {
                 $this->redirect('/my/portfolio/');
             }
         }
     }
 }
<figure class="accaunt-gallery__thumbnail">
      <a href="<?php 
echo $this->createUrl('user/album', array('id' => Yii::app()->getRequest()->getParam('id'), 'photo' => 'photo' . $data->id));
?>
"> 
        <img src="/users/<?php 
echo $data->uid;
?>
/370_<?php 
echo $data->file;
?>
" alt="<?php 
echo Users::model()->findByPk($data->uid)->name;
?>
 - Фотограф - <?php 
echo Portfolio::model()->findByPk(Yii::app()->getRequest()->getParam('id'))->title;
?>
" />
      </a>
</figure>
Esempio n. 10
0
 public function afterDelete()
 {
     //DebugBreak();
     Portfolio::model()->batchDelete(array($this->gallery_id));
     //deleting via DeletableBehavior
     return parent::afterDelete();
     //run parent event handler
 }
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     if ($model->occupation->templ == 'members') {
         $model->scenario = 'genre';
     }
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Users'])) {
         if ($_POST['member'] == 0) {
             $model->name = $_POST['Users']['name'];
             Yii::app()->user->name = $model->name;
             $model->gender = $_POST['Users']['gender'];
             $model->date_birth = $_POST['year_b'] . '-' . $_POST['month_b'] . '-' . $_POST['day_b'];
             $model->birth_public = $_POST['Users']['birth_public'];
             $model->city_id = $_POST['Users']['city_id'];
             $model->email = $_POST['Users']['email'];
             $model->about = $_POST['Users']['about'];
             $model->phone = $_POST['Users']['phone'];
             $model->phone2 = $_POST['Users']['phone2'];
             $model->phone3 = $_POST['Users']['phone3'];
             if ($model->validate() && $model->save()) {
                 Yii::app()->user->setFlash('success_save', '1');
                 $this->redirect(array('index'));
             }
             /*else { 
                   echo CHtml::errorSummary($model);
                   //exit();
               }*/
         }
         if ($_POST['member'] == 1) {
             //$model->attributes=$_POST['Users'];
             if (isset($_POST['Users']['name_studio'])) {
                 $_POST['Users']['name'] = $_POST['Users']['name_studio'];
                 //unset($_POST['Users']['name_studio']);
                 $model->setScenario('studio_update');
             }
             foreach ($_POST['Users'] as $k => $v) {
                 if ($k == 'photo') {
                     if ($v != '') {
                         $model->photo = CUploadedFile::getInstance($model, 'photo');
                     }
                 } elseif ($k == 'url') {
                     $v = str_replace('http://', '', $v);
                     $model->{$k} = $v;
                 } else {
                     $model->{$k} = $v;
                 }
             }
             if (!isset($_POST['Users']['phone2'])) {
                 $model->phone2 = '';
             }
             if (!isset($_POST['Users']['phone3'])) {
                 $model->phone3 = '';
             }
             if (isset($_POST['year_b'])) {
                 $model->date_birth = $_POST['year_b'] . '-' . $_POST['month_b'] . '-' . $_POST['day_b'];
             }
             Yii::app()->user->name = $model->name;
             //echo '<pre>';
             //print_r($_POST);
             //echo '</pre>';
             //exit();
             if (isset($_POST['Users']['genre_id'])) {
                 $model->genre_id = serialize($_POST['Users']['genre_id']);
             }
             if ($model->save()) {
                 if (isset($_POST['Users']['genre_id'])) {
                     Yii::import('application.modules.my.models.Portfolio');
                     Yii::import('application.modules.my.models.Video');
                     Yii::import('application.modules.my.models.Genre');
                     $keys = array();
                     $data = '';
                     $data = Portfolio::model()->findAllByAttributes(array('uid' => Yii::app()->user->id));
                     //print_r($data); exit();
                     if (is_array($data) && !empty($data)) {
                         //Portfolio::model()->deleteAllByAttributes(array('uid'=>Yii::app()->user->id));
                         //exit();
                         foreach ($_POST['Users']['genre_id'] as $genre) {
                             $item = Portfolio::model()->findByAttributes(array('uid' => Yii::app()->user->id, 'title' => Genre::getName($genre)));
                             if (count($item) > 0) {
                                 $keys[] = $item->id;
                             } else {
                                 $mod = new Portfolio();
                                 $mod->title = Genre::getName($genre);
                                 $mod->uid = Yii::app()->user->id;
                                 $mod->save();
                                 $keys[] = $mod->id;
                             }
                         }
                         $del = new Portfolio();
                         $criteria = new CDbCriteria();
                         $criteria->condition = 'uid=' . Yii::app()->user->id;
                         $criteria->addNotInCondition('id', $keys);
                         $del->deleteAll($criteria);
                     } else {
                         foreach ($_POST['Users']['genre_id'] as $genre) {
                             $mod = new Portfolio();
                             $mod->title = Genre::getName($genre);
                             $mod->uid = Yii::app()->user->id;
                             $mod->save();
                             //print_r($mod);
                         }
                         //exit();
                     }
                     //////////VIDEO/////////////////////////
                     $keys = array();
                     $data = '';
                     $data = Video::model()->findAllByAttributes(array('uid' => Yii::app()->user->id));
                     //print_r($data); exit();
                     if (is_array($data) && !empty($data)) {
                         //Portfolio::model()->deleteAllByAttributes(array('uid'=>Yii::app()->user->id));
                         //exit();
                         foreach ($_POST['Users']['genre_id'] as $genre) {
                             $item = Video::model()->findByAttributes(array('uid' => Yii::app()->user->id, 'title' => Genre::getName($genre)));
                             if (count($item) > 0) {
                                 $keys[] = $item->id;
                             } else {
                                 $mod = new Video();
                                 $mod->title = Genre::getName($genre);
                                 $mod->uid = Yii::app()->user->id;
                                 $mod->save();
                                 $keys[] = $mod->id;
                             }
                         }
                         $del = new Video();
                         $criteria = new CDbCriteria();
                         $criteria->condition = 'uid=' . Yii::app()->user->id;
                         $criteria->addNotInCondition('id', $keys);
                         $del->deleteAll($criteria);
                     } else {
                         foreach ($_POST['Users']['genre_id'] as $genre) {
                             $mod = new Video();
                             $mod->title = Genre::getName($genre);
                             $mod->uid = Yii::app()->user->id;
                             $mod->save();
                             //print_r($mod);
                         }
                         //exit();
                     }
                 } elseif (isset($_POST['Users']['hals'])) {
                     StudioHals::model()->deleteAllByAttributes(array('uid' => Yii::app()->user->id));
                     $h = 1;
                     while ($h <= $_POST['Users']['hals']) {
                         $mod = new StudioHals();
                         $mod->title = 'Зал ' . $h;
                         $mod->uid = Yii::app()->user->id;
                         $mod->save();
                         $h++;
                     }
                 }
                 Yii::app()->user->setFlash('success_save', '1');
                 $this->redirect(array('index'));
             }
             /*else { 
                   $this->render('index',array('model'=>$model));
                   //echo CHtml::errorSummary($model);
                   //exit();
               } */
         }
     }
     //if(empty($_POST['Users']['genre_id']))
     //    $model->addError('genre_id','Необходимо указать жанр, в котром Вы работаете.');
     $this->render('index', array('model' => $model));
 }
 public function actionVisible($id)
 {
     $m = $this->loadModel($id);
     if ($m->uid == Yii::app()->user->id) {
         if ($m->visible == 1) {
             $m->visible = 0;
             View::model()->deleteAllByAttributes(array('uid' => $m->uid, 'photo' => $m->file));
             $cover = Portfolio::model()->findBySql('select id from {{portfolio}} where uid=:uid and picture=:pic', array('uid' => $m->uid, 'pic' => $m->file));
             Portfolio::model()->updateByPk($cover->id, array('picture' => ''));
         } elseif ($m->visible == 0) {
             $m->visible = 1;
         }
         if ($m->save()) {
             $this->redirect($_GET['back']);
         }
     } else {
         throw new CHttpException(404, 'The requested album does not exist.');
     }
 }
 public function actionGetphotos()
 {
     $portfolio = Portfolio::model()->findAllByAttributes(array('uid' => $_POST['id']));
     $this->renderPartial('_photos', array('model' => $this->loadModel($_POST['id']), 'portfolio' => $portfolio));
 }
 /**
  * Validate data from form post 
  *  it's must making before saving into database
  * @param mixed $postData
  */
 public function validatePortfolio($postData)
 {
     $arrayPortfolio = array();
     foreach ($_POST['FileForm'] as $gallery_idx => $postPortfolio) {
         if (empty($postPortfolio['gallery_id'])) {
             $portfolio = new Portfolio();
         } else {
             $portfolio_id = $postPortfolio['gallery_id'];
             $portfolio = Portfolio::model()->with('photos')->findByPk($portfolio_id);
             if (!isset($portfolio)) {
                 $portfolio = new Portfolio();
             }
         }
         $portfolio->attributes = $postPortfolio;
         //assign attributes
         $valOK = $portfolio->validate();
         $arrayPhotosIds = array();
         //additional array for deleted photos search
         $deletedPhotos = array();
         //array for deleted photos
         $photos = array();
         //array of edited photos of portfolio
         $isTopPresent = false;
         //process photos array
         if (isset($postPortfolio['photos'])) {
             foreach ($postPortfolio['photos'] as $idx => $postPhoto) {
                 $photo_id = $postPhoto['photo_id'];
                 $isNewPhoto = empty($photo_id);
                 $photo = $isNewPhoto ? new Photo() : Photo::model()->findByPk($photo_id);
                 if ($isNewPhoto = !isset($photo)) {
                     $photo = new Photo();
                 }
                 $photo->attributes = $postPhoto;
                 $photo->gallery_id = $portfolio->gallery_id;
                 $photo->is_top = isset($postPortfolio['is_top']) && $idx == $postPortfolio['is_top'] ? Photo::POSITION_IS_TOP : Photo::POSITION_NO_TOP;
                 if ($photo->is_top) {
                     $isTopPresent = true;
                 }
                 //mark is_top present
                 $valOK = $photo->validate() && $valOK;
                 $arrayPhotosIds[$idx] = $postPhoto['photo_id'];
                 //add item to search array
                 $photos[$idx] = $photo;
             }
         }
         //validate photos (count)
         if ($postPortfolio['gallery_type'] == 1) {
             if (!count($photos)) {
                 $portfolio->addError('is_top', Yii::t('main', 'Portfolio must have photos'));
             } else {
                 if (!$isTopPresent) {
                     $portfolio->addError('is_top', Yii::t('main', 'In photo portfolio one of photo must be in top'));
                 }
             }
         }
         //search for deleted photos
         if (isset($portfolio->photos)) {
             foreach ($portfolio->photos as $photo) {
                 if (!in_array($photo->photo_id, $arrayPhotosIds)) {
                     $portfolio->deletedPhotos[] = $photo;
                 }
             }
         }
         $portfolio->photos = $photos;
         //add photo items to portfolio model
         $arrayPortfolio[] = $portfolio;
         //add instance of portfolio to returning array
     }
     return $arrayPortfolio;
     //returning result array of portfolio instances
 }
Esempio n. 15
0
echo $form->error($model, 'title');
?>
                      </div>
                      <div class="col-6 edit-photo__title"><label for="text1">Описание</label></div>
                      <div class="col-12 edit-photo__description">
                        <?php 
echo $form->textArea($model, 'description', array('cols' => 30, 'rows' => 3, 'placeholder' => 'Данная информаця будет видна другим авторам и потенциальным клиентам'));
?>
                        <?php 
echo $form->error($model, 'description');
?>
                      </div>
                      <div class="col-6 edit-photo__title"><label for="text1">Альбом</label></div>
                      <div class="col-12 edit-photo__description">
                        <?php 
echo $form->dropDownList($model, 'portfolio_id', CHtml::listData(Portfolio::model()->findAllByAttributes(array('uid' => Yii::app()->user->id)), 'id', 'title'), array('class' => 'default__input', 'empty' => ''));
?>
                        <?php 
echo $form->error($model, 'portfolio_id');
?>
                      </div>
                      <div class="col-179">
                        <?php 
echo CHtml::hiddenField('Files[type]', 'photo');
?>
                        <?php 
echo CHtml::hiddenField('Files[uid]', Yii::app()->user->id);
?>
                        <?php 
echo CHtml::submitButton('СОХРАНИТЬ', array('class' => 'cabinet__profile__btn cabinet__profile__btn-submit'));
?>
Esempio n. 16
0
<?php

$this->widget('application.extensions.tooltipster.tooltipster', array('identifier' => '#show_tooltip', 'options' => array('position' => 'bottom')));
foreach ($model as $item) {
    $c = Portfolio::model()->findByPk($item->portfolio_id);
    if ($c->picture == $item->file) {
        $chk = 'checked';
    } else {
        $chk = '';
    }
    ?>
    <div class="data_<?php 
    echo $item->id;
    ?>
">
        <figure class="cabinet__photo__item2">
            <a href="/users/<?php 
    echo Yii::app()->user->id;
    ?>
/<?php 
    echo $item->file;
    ?>
" rel="gallery1" class="photo__zoom">
                <img src="/users/<?php 
    echo Yii::app()->user->id;
    ?>
/370_<?php 
    echo $item->file;
    ?>
" alt="">
            </a>
Esempio n. 17
0
          <tr>
            <th>Название услуги</th>
            <th>Пакет 1 (грн.)</th>
            <th>Пакет 2 (грн.)</th>
            <th>Пакет 3 (грн.)</th>
            <th>Пакет 4 (грн.)</th>
            <th>Пакет 5 (грн.)</th>
          </tr>
          <?php 
//$genres=unserialize($user->genre_id);
//print_r($genres); exit();
if ($user->occupation_id == 2) {
    //videooperator
    $genres = Video::model()->findAllByAttributes(array('uid' => $user->id));
} else {
    $genres = Portfolio::model()->findAllByAttributes(array('uid' => $user->id));
}
foreach ($genres as $val) {
    if ($user->occupation_id == 2) {
        $cnt_files = Files::model()->countByAttributes(array('uid' => $user->id, 'type' => 'video', 'portfolio_id' => $val->id));
    } else {
        $cnt_files = Files::model()->countByAttributes(array('uid' => $user->id, 'type' => 'photo', 'portfolio_id' => $val->id));
    }
    if ($cnt_files > 0) {
        echo '<tr>
                        <td>' . $val->title . '</td>';
        //$pack1=Prices::model()->findByAttributes(array('price'),'genre_id=:gen and package=1',array(':gen'=>$val));
        $pack1 = Prices::model()->findByAttributes(array('genre_id' => $val->id, 'package' => 1));
        if (is_object($pack1)) {
            $tip = "<div class='tooltip_cost_title'>" . $val->title . "</div>\n                                <p class='tooltip_cost_text'>Описание услуги: " . $pack1->about . "</p>";
            echo '<td><span class="tooltipster_front" title="' . $tip . '" data-set="' . $val->id . '_1">' . $pack1->price . 'грн <div class="cost-info"></div></span></td>';