Example #1
0
 public function actionApteki($id)
 {
     $one = EditUr_l::getOne($id);
     $arr = ArrayHelper::toArray($one);
     $wabc = $arr[wabc];
     $AptekiList = Lists::getApteki($wabc);
     if ($_POST['EditUr_l']) {
         $one->attributes = $_POST['EditUr_l'];
         if ($one->validate() && $one->save()) {
             return $this->render('ur_l', ['model' => $one, 'ok' => 1, 'apteki' => $AptekiList]);
         }
     }
     return $this->render('ur_l', ['model' => $one, 'apteki' => $AptekiList]);
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Lists::find();
     $query->select($this->tableName() . '.*, COUNT(' . UserLists::tableName() . '.user_id) AS users_count');
     $query->leftJoin(UserLists::tableName(), UserLists::tableName() . '.list_id = ' . $this->tableName() . '.id');
     $query->groupBy([$this->tableName() . '.id']);
     $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, 'DATE(last_sent)' => $this->last_sent, 'DATE(created)' => $this->created, 'DATE(modified)' => $this->modified]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     $dataProvider->setSort(['attributes' => ['id', 'name', 'last_sent', 'created', 'modified', 'users_count' => ['asc' => ['users_count' => SORT_ASC], 'desc' => ['users_count' => SORT_DESC], 'label' => 'Parent Name', 'default' => SORT_ASC]]]);
     return $dataProvider;
 }
Example #3
0
 public function init()
 {
     $lists = Lists::getLists();
     return view('lists')->with('controllerFunction', 'show')->with('lists', $lists);
 }
Example #4
0
 /**
  * Finds the Lists model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Lists the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Lists::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getList()
 {
     return $this->hasOne(Lists::className(), ['id' => 'list_id']);
 }
Example #6
0
?>

    <?php 
echo $form->field($model, 'subject')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'body')->widget(\yii\redactor\widgets\Redactor::className());
?>

    <?php 
echo $form->field($model, 'send_as_copy')->checkbox();
?>

    <?php 
$lists = \app\models\Lists::find()->all();
$items = ArrayHelper::map($lists, 'id', 'name');
?>
    <?php 
echo $form->field($model, 'list_id')->dropDownList($items, ['prompt' => '[Select list]']);
?>

    <div class="alert-block">* Emails for blocked users will not send</div>


    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Example #7
0
 public function delete()
 {
     Lists::deleteList();
     return redirect('/lists');
 }
 public function actionAdd()
 {
     $request = Yii::$app->request;
     if ($request->isAjax) {
         $list = new Lists();
         $list->doctor_id = $request->post('doctor_id');
         $list->patient_id = Yii::$app->user->getId();
         $list->status = Lists::STATUS_INACTIVE;
         $list->date = $request->post('date');
         if ($list->insert()) {
             return true;
         } else {
             return false;
         }
     }
 }