Esempio n. 1
0
 public function postCreateSection(Request $request)
 {
     $section = new Section();
     $section->title = $request->input('title');
     $section->slug = str_slug($request->input('title'), '-');
     $section->save();
     return redirect(route('getSections'))->with('messages', 'Section	 created.');
 }
 public function testSetRoomScheduleSection()
 {
     $roomsched = new RoomSchedule();
     $section = new Section();
     $section->setSectionCode("4A");
     $roomsched->setSectionCode($section->getSectionCode());
     $this->assertEquals("4A", $section->getSectionCode());
     $this->assertEquals("4A", $roomsched->getSectionCode());
 }
 public function saveNewSectionRecord()
 {
     $section = new Section();
     $section['year_id'] = Input::get('drpYear');
     $section['description'] = Input::get('txtSection');
     if ($section->save()) {
         return 1;
     } else {
         return 0;
     }
 }
 public function actionSection($id)
 {
     $section = Section::find()->where(['grade_level_id' => $id])->all();
     foreach ($section as $item) {
         echo '<option value="' . $item->id . '">' . $item->section_name . '</option>';
     }
 }
 public function destroy($id)
 {
     $section = Section::find($id);
     if (count($section->pages) > 0) {
         return false;
     }
     $section->delete();
     return true;
 }
Esempio n. 6
0
 private function getAllSection()
 {
     $section = Section::find()->where(['uid' => Yii::$app->user->id])->all();
     $section_array['公司'] = "公司";
     foreach ($section as $item) {
         $name = $item->getAttribute('name');
         $section_array[$name] = $name;
     }
     return $section_array;
 }
Esempio n. 7
0
 public function allSections()
 {
     $response = array();
     $infos = Section::all();
     if (!empty($infos)) {
         foreach ($infos as $info) {
             $response[] = array("info_id" => $info['id'], "year" => $this->yearInfo($info['year_id'])['description'], "year_id" => $info['year_id'], "data_description" => $info['description']);
         }
     }
     return $response;
 }
 public function testSetSection()
 {
     $section = new Section();
     $section->setSectionCode("IT4B");
     $section->setCourseCode("IT 109");
     $section->setClassSize(30);
     $this->assertEquals("IT4B", $section->getSectionCode());
     $this->assertEquals("IT 109", $section->getCourseCode());
     $this->assertEquals(30, $section->getClassSize());
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('section')->truncate();
     DB::table('user_section')->truncate();
     $sections = json_decode(File::get('database/migrations/jsondata/sections.json'));
     foreach ($sections as $section) {
         $arrColumns = array();
         foreach ($section as $columnName => $columnValue) {
             $arrColumns[$columnName] = $section->{$columnName};
         }
         Section::create(array('id' => '', 'title' => $arrColumns['title'], 'route' => $arrColumns['route'], 'is_restricted' => $arrColumns['is_restricted']));
     }
 }
Esempio n. 10
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Section::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent' => $this->parent, 'uid' => Yii::$app->user->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Esempio n. 11
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Section::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['sec_id' => $this->sec_id, 'sec_created' => $this->sec_created]);
     $query->andFilterWhere(['like', 'sec_title', $this->sec_title])->andFilterWhere(['like', 'sec_cnf_id', $this->sec_cnf_id]);
     return $dataProvider;
 }
Esempio n. 12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function searchSection($params)
 {
     $query = Section::find();
     $pageSize = Yii::$app->params['pageSize'];
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['section_name'] = ['asc' => ['section_name' => SORT_ASC], 'desc' => ['section_name' => SORT_DESC]];
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['section_name' => SORT_ASC]], 'pagination' => ['pageSize' => $pageSize]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'grade_level_id' => $this->grade_level_id]);
     $query->andFilterWhere(['like', 'section_name', $this->section_name]);
     return $dataProvider;
 }
Esempio n. 13
0
    /**
     * @param int|array $id id секций для получения по ним статистики
     */
    public static function getConferenceStat($id = 0)
    {
        // посчитаем гостей, руководителей и участников
        $sWhere = $id === 0 ? 'prs_sec_id > 0' : (is_array($id) ? 'prs_sec_id in (' . implode(',', $id) . ')' : 'prs_sec_id = ' . $id);
        $sSql = <<<EOT
Select SUM(IF(p.prs_type = 1, 1, 0 )) As cou_guest,
       SUM(IF(p.prs_type = 3 Or p.prs_type = 4, 1, 0 )) As cou_member,
       SUM(IF(p.prs_type = 2, 1, 0 )) As cou_consult,
       prs_sec_id
From confprof_person p
Where {$sWhere}
Group By prs_sec_id
Order By prs_sec_id
EOT;
        $aSectPerson = ArrayHelper::map(Yii::$app->db->createCommand($sSql)->queryAll(PDO::FETCH_ASSOC), 'prs_sec_id', function ($el) {
            return $el;
        });
        // пробежимся по секциям и докладам
        $q = Section::find()->with(['conference', 'doclads']);
        if ($id !== 0) {
            $q->where(['prs_sec_id' => $id]);
        }
        $aSect = $q->all();
        $aRet = [];
        foreach ($aSect as $oSect) {
            /** @var Section $oSect */
            $adata = ['sect_id' => $oSect->sec_id, 'sect' => $oSect->sec_title, 'conf' => $oSect->conference->cnf_title, 'doclads' => count($oSect->doclads)];
            $adata = array_merge($adata, isset($aSectPerson[$oSect->sec_id]) ? $aSectPerson[$oSect->sec_id] : ['cou_guest' => 0, 'cou_member' => 0, 'cou_consult' => 0]);
            // посчитаем уникальных лидеров проектов
            $aLeader = [];
            foreach ($oSect->doclads as $oDocl) {
                /** @var Doclad $oDocl */
                if (!isset($aLeader[$oDocl->doc_lider_email])) {
                    $aLeader[$oDocl->doc_lider_email] = 0;
                }
                $aLeader[$oDocl->doc_lider_email]++;
                // это на всякий случай
            }
            $adata['leaders'] = count($aLeader);
            $aRet[] = $adata;
        }
        return $aRet;
    }
Esempio n. 14
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $aDop = [])
 {
     $query = Person::find();
     $query->with(Yii::$app->user->can(User::USER_GROUP_MODERATOR) ? ['section', 'section.conference'] : []);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $sFormname = $this->formName();
     if (!isset($params[$sFormname])) {
         $params[$sFormname] = [];
     }
     $params[$sFormname] = array_merge($params[$sFormname], $aDop);
     $this->load($params);
     if (!empty($this->conferenceid)) {
         $query->joinWith(['section']);
         $query->andFilterWhere([Section::tableName() . '.sec_cnf_id' => $this->conferenceid]);
     }
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['prs_id' => $this->prs_id, 'prs_active' => $this->prs_active, 'prs_type' => $this->prs_type, 'prs_sec_id' => $this->prs_sec_id, 'prs_doc_id' => $this->prs_doc_id, 'ekis_id' => $this->ekis_id, 'prs_hischool' => $this->prs_hischool]);
     $query->andFilterWhere(['like', 'prs_fam', $this->prs_fam])->andFilterWhere(['like', 'prs_name', $this->prs_name])->andFilterWhere(['like', 'prs_otch', $this->prs_otch])->andFilterWhere(['like', 'prs_email', $this->prs_email])->andFilterWhere(['like', 'prs_phone', $this->prs_phone])->andFilterWhere(['like', 'prs_org', $this->prs_org])->andFilterWhere(['like', 'prs_group', $this->prs_group])->andFilterWhere(['like', 'prs_position', $this->prs_position])->andFilterWhere(['like', 'prs_lesson', $this->prs_lesson]);
     return $dataProvider;
 }
Esempio n. 15
0
File: _form.php Progetto: poykub/wph
?>
      </p>
      <div class="box box-info">
        <div class="box-header">
          <h3 class="box-title"> บันทึกการปฏิบัติงาน</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
          <?php 
$form = ActiveForm::begin(['fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'offset' => 'col-sm-offset-2', 'wrapper' => 'col-sm-10']], 'options' => ['enctype' => 'multipart/form-data']]);
?>

          <div class="row">
            <div class="col-md-4">
              <?php 
echo $form->field($model, 'section_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Section::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'หน่วยงาน/ฝ่าย/แผนก...'], 'pluginOptions' => ['allowClear' => true]]);
?>
            </div>
            <div class="col-md-3">
                  <?php 
echo $form->field($model, 'equipment_id')->inline(true)->radiolist(['1' => 'Software', '2' => 'Hardware', '3' => 'อื่นๆ']);
?>
            </div>
            <div class="col-md-5">
              <?php 
echo '<label>วันที่/เวลา ที่ดำเนินการ</label>';
echo DateTimePicker::widget(['model' => $model, 'attribute' => 'datetime', 'options' => ['placeholder' => 'เลือกวันที่ และเวลา ...'], 'pickerButton' => ['icon' => 'time'], 'removeButton' => false, 'pluginOptions' => ['todayHighlight' => true, 'autoclose' => true, 'showSeconds' => false, 'showMeridian' => false, 'minuteStep' => 1, 'secondStep' => 5], 'language' => 'th']);
?>
            </div>

          </div>
Esempio n. 16
0
 /**
  * Export data without division to section
  * @return mixed
  */
 public function actionExportall()
 {
     $searchModel = new DocladSearch();
     $searchModel->conferenceid = Yii::$app->db->createCommand('Select s.sec_cnf_id' . ' From ' . Usersection::tableName() . ' us, ' . Section::tableName() . ' s' . ' Where s.sec_id = us.usec_section_id And us.usec_section_primary = 1 And us.usec_user_id = :uid', [':uid' => Yii::$app->user->getId()])->queryColumn();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     //        echo nl2br(print_r($searchModel->conferenceid, true));
     //        return;
     $sDir = Yii::getAlias('@webroot/assets');
     $sFileName = $sDir . DIRECTORY_SEPARATOR . 'doclad-all-' . date('Y-m-d-H-i-s') . '.xls';
     $this->clearDestinationDir($sDir, 'xls', time() - 300);
     $this->exportToFile($dataProvider, $sFileName);
     Yii::$app->response->sendFile($sFileName);
     //        return $this->renderContent(
     //            Html::a(
     //                'Загрузить',
     //                substr($sFileName, str_replace(DIRECTORY_SEPARATOR, '/', strlen($_SERVER['DOCUMENT_ROOT'])))
     //            )
     //        );
 }
Esempio n. 17
0
 /**
  * Finds the Section model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Section the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Section::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Запрашиваемая страница не существует.');
     }
 }
Esempio n. 18
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSender0()
 {
     return $this->hasOne(Section::className(), ['id' => 'sender']);
 }
Esempio n. 19
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSections()
 {
     return $this->hasMany(Section::className(), ['updated_by' => 'user_id']);
 }
Esempio n. 20
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSections()
 {
     return $this->hasMany(Section::className(), ['catalog_id' => 'id_catalog']);
 }
Esempio n. 21
0
 public static function section($data)
 {
     $data = Section::find()->where(['id' => $data])->one();
     return $data->section_name;
 }
Esempio n. 22
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSection()
 {
     return $this->hasOne(Section::className(), ['sec_id' => 'usec_section_id']);
 }
 public function actionBand()
 {
     if (isset($_POST['start']) || isset($_POST['finish'])) {
         $start = Yii::$app->request->post('start');
         $finish = Yii::$app->request->post('finish');
         $catalog = Yii::$app->request->post('catalog');
         if ($catalog != 'all') {
             $section = Section::find()->where(['=', 'catalog_id', $catalog])->all();
             foreach ($section as $vlSection) {
                 $sect[] = $vlSection->id_section;
             }
             foreach ($sect as $vlSect) {
                 $band = Product::find()->where(['BETWEEN', 'price', $start, $finish])->andWhere(['=', 'section_id', $vlSect])->orderBy('price')->all();
             }
         } else {
             $band = Product::find()->where(['BETWEEN', 'price', $start, $finish])->orderBy('price')->all();
         }
     }
     return $this->renderAjax('band', ['band' => $band]);
 }
Esempio n. 24
0
                            console.log(data);
                            $( "select#assignedform-subject_id" ).html(data);
                                $.post( "' . Yii::$app->urlManager->createUrl('assign-subject/section?id=') . '"+parseInt($("#assignedform-grade_level_id").val()), function( data ) {
                                    $("#assignedform-section_id").find("option").remove();
                                    $("#assignedform-section_id").each(function(){
                                    $(this).append(data);
                                });
                            });
                        })'])->label(false);
?>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-4 col-md-12 col-sm-12">
                    <?php 
echo $form->field($model, 'section_id', ['inputTemplate' => '<label style="padding: 0; color: #555; font-weight: 600;">Grade Level</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->dropDownList(ArrayHelper::map(Section::find()->all(), 'id', 'section_name'), ['id', 'section_name'])->label(false);
?>
                </div>
            </div>
        </div>
    </div>
    <div class="three wide rounded column">
        <div class="column">
            <?php 
echo Options::render(['scenario' => Yii::$app->controller->action->id, 'id' => $model->id, 'exist' => false]);
?>
        </div>
    </div>
</div>
<?php 
ActiveForm::end();
Esempio n. 25
0
use yii\helpers\HtmlPurifier;
use kartik\select2\Select2;
use app\models\ApplicantForm;
use app\models\ActiveRecord;
use app\models\StudentForm;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use app\models\GradeLevel;
use app\models\Section;
use app\models\SchoolYear;
use app\models\Card;
use app\models\DataHelper;
$card_url = json_encode(Yii::$app->request->baseUrl . '/site/card?data=');
$current_date = date('Y');
$school_year = SchoolYear::find()->orderBy(['id' => SORT_DESC])->all();
$section = Section::find()->all();
$grade_level = GradeLevel::find()->where(['!=', 'id', 0])->all();
$status = [['id' => 1, 'status' => 'Pending'], ['id' => 0, 'status' => 'Enrolled']];
$listData = ArrayHelper::map($grade_level, 'id', 'name');
$listData2 = ArrayHelper::map($school_year, 'id', 'sy');
$listData3 = ArrayHelper::map($section, 'id', 'section_name');
$listData4 = ArrayHelper::map($status, 'id', 'status');
$state = false;
$avatar = Yii::$app->request->baseUrl . Yii::$app->params['avatar'];
!$model->isNewRecord ? !empty($model->student->students_profile_image) ? $img = Yii::$app->request->baseUrl . '/uploads/students/' . $model->student->students_profile_image : ($img = $avatar) : '';
!$model->isNewRecord ? !empty(trim($model->student->middle_name)) ? $middle = ucfirst(substr($model->student->middle_name, 0, 1)) . '.' : ($middle = '') : '';
!$model->isNewRecord ? $this->title = implode(' ', [$model->student->first_name, $middle, $model->student->last_name]) : 'New';
$model->isNewRecord ? $this->title = 'New' : ($this->title = implode(' ', [$model->student->first_name, $middle, $model->student->last_name]));
$form = ActiveForm::begin();
?>
<div class="ui three column stackable grid">
Esempio n. 26
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSectionsdata()
 {
     return $this->hasMany(Section::className(), ['sec_id' => 'usec_section_id'])->via('sections');
 }
Esempio n. 27
0
 /**
  * Finds the Section model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Section the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Section::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 28
0
    <p>
        <?php 
echo Html::a('Добавить пользователя', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\DataColumn', 'attribute' => 'us_email', 'format' => 'raw', 'content' => function ($model, $key, $index, $column) use($aGroups) {
    /** @var User $model */
    return Html::encode($model->us_email) . '<br />' . Html::encode($model->us_name);
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'us_group', 'filter' => $aGroups, 'content' => function ($model, $key, $index, $column) use($aGroups) {
    /** @var User $model */
    $sDop = '';
    // ( ($model->us_group == User::USER_GROUP_MODERATOR) && ($model->us_mainmoderator == 1) ) ? '<span class="glyphicon glyphicon-star"></span> ' : '';
    return $sDop . Html::encode(isset($aGroups[$model->us_group]) ? $aGroups[$model->us_group] : '??');
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'us_mainmoderator', 'filter' => [1 => 'Ответственный'], 'content' => function ($model, $key, $index, $column) use($aGroups) {
    /** @var User $model */
    $sDop = $model->us_group == User::USER_GROUP_MODERATOR && array_reduce($model->sections, function ($carry, $el) {
        return $carry || $el->usec_section_primary;
    }, false) ? '<span class="glyphicon glyphicon-star"></span>' : '';
    return $sDop;
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'sectionids', 'filter' => Section::getSectionList(), 'content' => function ($model, $key, $index, $column) {
    /** @var User $model */
    return implode('<br />', ArrayHelper::map($model->sections, 'usec_id', function ($el) {
        return Html::encode($el->section->sec_title) . ($el->usec_section_primary ? ' <span class="glyphicon glyphicon-star"></span>' : '');
    }));
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Esempio n. 29
0
 public static function itemsAlias($key)
 {
     $items = ['eqmType' => ArrayHelper::map(Comequipmenttype::find()->all(), 'id', 'name'), 'comBrand' => ArrayHelper::map(Combrand::find()->all(), 'id', 'name'), 'warranty' => ArrayHelper::map(Comwarranty::find()->all(), 'id', 'name'), 'dealer' => ArrayHelper::map(Comdealer::find()->all(), 'id', 'dealerName'), 'location' => ArrayHelper::map(Section::find()->all(), 'id', 'name'), 'status' => [1 => 'กำลังใช้งาน', 2 => 'พร้อมใช้งาน', 3 => 'อยู่ระหว่างซ่อม', 4 => 'ส่งซ่อม', 5 => 'ชำรุด/ซ่อมไม่ได้', 6 => 'จำหน่ายออก']];
     return ArrayHelper::getValue($items, $key, []);
     //return array_key_exists($key, $items) ? $items[$key] : [];
 }
Esempio n. 30
0
use yii\helpers\ArrayHelper;
use app\models\Section;
use app\models\Catalog;
/* @var $this yii\web\View */
/* @var $model app\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'section_id')->dropDownList(ArrayHelper::map(Section::find()->with('catalog')->all(), 'id_section', function ($items) {
    return $items->catalog->catalog_name . ' -> ' . $items->section_name;
}));
?>

    <?php 
echo $form->field($model, 'product_name')->label('Продукт')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'description')->label('Описание')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'price')->label('Цена')->textInput(['maxlength' => true]);
?>