예제 #1
0
 public function init()
 {
     if (empty($_GET['language'])) {
         $_GET['language'] = 'ru';
     }
     if (isset($_GET['alias'])) {
         $id = Occupation::model()->findBySql('select id from {{occupation}} where alias="' . $_GET['alias'] . '"');
         if (count($id) > 0) {
             $_GET['id'] = $id->id;
         }
     }
     //print_r($_GET);
     Yii::app()->language = $_GET['language'];
     parent::init();
 }
 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();
 }
    <?php 
}
?>
    
    <!--div class="default-input__container">
      <div class="col-275">
        <?php 
echo $form->labelEx($model, 'occupation_id', array('class' => 'default-input__label'));
?>
      </div>
      <div class="col-384">
        <?php 
//echo $form->textField($model,'url',array('class'=>'default__input','placeholder'=>'http://www.site.com'))
?>
        <?php 
echo $form->dropDownList($model, 'occupation_id', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'), array('empty' => '- select -', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('profile/genresublist'), 'update' => '#Users_genre_id'), 'class' => 'default__input'));
?>
        <?php 
echo $form->error($model, 'occupation_id');
?>
      </div>
    </div-->
    <div class="default-input__container">
      <div class="col-275">
        <?php 
echo $form->labelEx($model, 'genre_id', array('class' => 'default-input__label'));
?>
      </div>
      <div class="col-384">
        <?php 
//echo $form->textField($model,'url',array('class'=>'default__input','placeholder'=>'http://www.site.com'));
예제 #4
0
if (isset(Yii::app()->request->cookies['city'])) {
    $active = Yii::app()->request->cookies['city']->value;
} else {
    $active = '';
}
echo CHtml::dropDownList('city', $active, CHtml::listData(City::model()->findAll(), 'id', 'name'), array('id' => 'tender_city', 'empty' => 'Укажите ближайший город'));
?>
          </div>
          <!-- div class="search__hidden__float-container search__hidden__float-container--w210">
            <label for="datepicker" class="search__hidden__input-label">Дата мероприятия</label>
            <input type="text" id="datepicker" name="" placeholder="Выберите дату" class="search__hidden__input search__hidden__input--datepicker" />
          </div-->
          <div class="search__hidden__float-container search__hidden__float-container--w310">
            <label for="genre" class="search__hidden__input-label">Услуга</label>
            <?php 
echo CHtml::dropDownList('occupation', '', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'), array('id' => 'tender_genre', 'empty' => 'Выберите нужную услугу'));
?>
          </div>
          <div class="search__hidden__float-container search__hidden__float-container--w236">
            <label for="minPrice" class="search__hidden__input-label search__hidden__input-label_pl10">Стоимость, грн</label>
            <div class="search__hidden__price-container">
              <input type="text" name="price_from" id="minPrice" class="search__hidden__input" placeholder="от">
            </div>
            <div class="search__hidden__price-container">
              <input type="text" name="price_to" class="search__hidden__input" placeholder="до">
            </div>
          </div>
          <!--div class="clfx"></div>
          <div class="radio-wrapper">
            <div class="checkbox-name">Пол участника</div>
            <input class="radio" type="radio" name="lorem" id="radio-1">
예제 #5
0
 ?>
         <?php 
 //echo $form->errorSummary($model_t);
 ?>
           <div class="default-input__container">
             <div class="col-181">
                 <?php 
 echo $form->labelEx($model_t, 'occupation', array('class' => 'default-input__label'));
 ?>
             </div>
             <div class="col-674">
                 <?php 
 //echo $form->dropDownList($model_t,'occupation',CHtml::listData(City::model()->findAll(),'id','name'),array('class'=>'default__input','empty'=>''));
 ?>
                 <?php 
 echo $form->dropDownList($model_t, 'occupation', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'), array('empty' => '', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/my/tenders/genresublist'), 'success' => 'function(html) 
                                             { 
                                                 if(html!="") {
                                                     jQuery("#genre_show").css("display", "block");
                                                     jQuery("#Tenders_genre").html(html);
                                                 }
                                                 else {
                                                     jQuery("#genre_show").css("display", "none");
                                                 }
                                             }'), 'class' => 'default__input'));
 ?>
                 <?php 
 echo $form->error($model_t, 'occupation');
 ?>
          
             </div>
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Occupation the loaded model
  * @throws CHttpException
  */
 public function loadModel($id, $ml = false)
 {
     if ($ml) {
         $model = Occupation::model()->multilang()->findByPk((int) $id);
     } else {
         $model = Occupation::model()->findByPk((int) $id);
     }
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #7
0
 public function getName($id)
 {
     $data = Occupation::model()->findByPk($id);
     return $data->name;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Occupation::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #9
0
    //if($i%8==0) {
    //    echo '</ul></li>';
    //    echo '      <li class="dropdownmenu__item">
    //            <ul class="dropdownmenu__item__list">';
    //}
    echo '<li class="dropdownmenu__item__list__item"><h3 class="dropdownmenu__item__list__item__title">' . $v->name . '</h3></li>';
    $model = new Occupation();
    $list1 = $model->localized('ru')->findAll('cat_id=:cid', array(':cid' => $v->id));
    $i = 1;
    foreach ($list1 as $k1 => $v1) {
        //echo '<li class="dropdownmenu__item__list__item"><a href="" class="dropdownmenu__item__list__item__link">Воздушные акробаты<span class="dropdown__link__col">&nbsp;(25)</span></a></li>';
        if ($v1->alias != '') {
            $alias = $v1->alias;
        } else {
            $alias = Settings::toLatin($v1->name);
            Occupation::model()->updateByPk($v1->id, array('alias' => $alias));
        }
        if (Yii::app()->getRequest()->getParam('id') == $v1->id && Yii::app()->controller->id == 'cat') {
            echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link dropdownmenu__item__list__item__link--current">' . $v1->name . '<span class="dropdown__link__col">&nbsp;(' . Occupation::CalcUsers($v1->id) . ')</span></a></li>';
        } else {
            echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link">' . $v1->name . '<span class="dropdown__link__col">&nbsp;(' . Occupation::CalcUsers($v1->id) . ')</span></a></li>';
        }
        //$i++;
    }
}
?>
            </ul>
          </li>  
        </ul>
    </div>
  </div>
예제 #10
0
 public function getName($id)
 {
     $data = Occupation::model()->findByPk($id);
     if (count($data) > 0) {
         return $data->name;
     } else {
         return false;
     }
 }
예제 #11
0
    ?>
    		<?php 
    echo $form->error($model, 'name' . $suffix);
    ?>
    	</div>
    </fieldset>
    <?php 
}
?>
    
    <div class="row">
		<?php 
echo $form->labelEx($model, 'occ_id');
?>
        <?php 
echo $form->dropDownList($model, 'occ_id', CHtml::listData(Occupation::model()->findAll(), 'id', 'name'));
?>
		<?php 
echo $form->error($model, 'occ_id');
?>
	</div>

	<div class="row buttons">
		<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save');
?>
	</div>

<?php 
$this->endWidget();
?>
예제 #12
0
 public function getSearchList()
 {
     $res = array();
     $occ = Occupation::model()->findAll();
     foreach ($occ as $item) {
         $action = Actions::model()->countBySql('select id from {{actions}} where occupation_id="' . $item->id . '" and date_end>="' . date('Y-m-d') . '"');
         if ($action > 0) {
             $res[$item->id] = $item->name;
         }
     }
     $res_list = '';
     foreach ($res as $k => $v) {
         $res_list .= '<option value="' . $k . '">' . $v . '</option>';
     }
     return $res;
 }
 public function actionCreate_occ()
 {
     $model = new Occupation();
     if (isset($_POST['Occupation'])) {
         $cat = Occupation::model()->countByAttributes(array('cat_id' => $_POST['Occupation']['cat_id'], 'name' => $_POST['Occupation']['name']));
         if ($cat <= 0) {
             $templ = Occupation::model()->findByAttributes(array('cat_id' => $_POST['Occupation']['cat_id']));
             $model->name = $_POST['Occupation']['name'];
             $model->cat_id = $_POST['Occupation']['cat_id'];
             $model->templ = $templ->templ;
             if ($model->save()) {
                 Yii::app()->user->setFlash('create_occ', '1');
                 //$this->redirect(array('/register/step3/uid/'.$_POST['uid'],'add'=>1));
                 $this->actionAdd_occ($model->id, $_POST['uid']);
             } else {
                 print_r($model->getErrors());
             }
         } else {
             Yii::app()->user->setFlash('add_occ', '1');
             //$this->redirect(array('/register/step3/uid/'.$_POST['uid']));
             $this->actionAdd_occ($cat->id, $_POST['uid']);
         }
     }
 }
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#fameducation_dialog").dialog("open"); return false;'));
?>
		<?php 
echo $form->error($model, 'educationid');
?>
          </div>
      </td>
      <td>
<div class="row">
		<?php 
echo $form->labelEx($model, 'occupationid');
echo $form->hiddenField($model, 'occupationid');
?>
          <input type="text" name="occupation_name" id="occupation_name" readonly value="<?php 
echo Occupation::model()->findByPk($model->occupationid) !== null ? Occupation::model()->findByPk($model->occupationid)->occupationname : '';
?>
">
          <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'occupation_dialog', 'options' => array('title' => Yii::t('app', 'Occupation'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$occupation = new Occupation('searchwstatus');
$occupation->unsetAttributes();
// clear any default values
if (isset($_GET['Occupation'])) {
    $occupation->attributes = $_GET['Occupation'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'occupation-grid', 'dataProvider' => $occupation->Searchwstatus(), 'filter' => $occupation, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("V",
                array("name" => "send_occupation",
                "id" => "send_occupation",
                "onClick" => "$(\\"#occupation_dialog\\").dialog(\\"close\\"); $(\\"#occupation_name\\").val(\\"$data->occupationname\\"); $(\\"#Employeefamily_occupationid\\").val(\\"$data->occupationid\\");"))'), array('name' => 'occupationid', 'visible' => false, 'value' => '$data->occupationid', 'htmlOptions' => array('width' => '1%')), 'occupationname')));
$this->endWidget('zii.widgets.jui.CJuiDialog');