/**
  * Get all Degree to show in dropdown
  *
  * @return Array
  */
 public function getAllDegree()
 {
     $degrees = Degree::all(array('id', 'degreeName'))->toArray();
     array_unshift($degrees, array('id' => "", 'degreeName' => "Select Degree"));
     $result = array();
     foreach ($degrees as &$degree) {
         $result[$degree['id']] = $degree['degreeName'];
     }
     return $result;
 }
Пример #2
0
 public function search($input)
 {
     $query = Degree::query();
     $columns = Schema::getColumnListing('degrees');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Пример #3
0
?>

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

                    <?php 
if (Yii::$app->user->can('projectManager')) {
    echo $form->field($rol, 'organization')->textInput();
} else {
    if (Yii::$app->user->can('socialServiceManager')) {
        echo $form->field($rol, 'faculty_id')->dropDownList(ArrayHelper::map(Faculty::find()->all(), 'id', 'name'));
    } else {
        if (Yii::$app->user->can('student')) {
            echo $form->field($rol, 'faculty_id')->dropDownList(ArrayHelper::map(Faculty::find()->all(), 'id', 'name'));
            echo $form->field($rol, 'degree_id')->dropDownList(ArrayHelper::map(Degree::find()->all(), 'id', 'name'));
            echo $form->field($rol, 'current_semester')->textInput();
            echo $form->field($rol, 'enrollment_id')->textInput();
        }
    }
}
?>

                </div>

            </div>


            <div class="form-group">
                <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update Account'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
Пример #4
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="student-index">

    <div class="well well-sm">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['enrollment_id', ['attribute' => 'Nombre', 'value' => function ($dataProvider) {
    $user = \app\models\User::findOne(['id' => $dataProvider->user_id]);
    $person = \app\models\Person::findOne(['id' => $user->person_id]);
    return $person->name . ' ' . $person->lastname;
}], ['attribute' => 'Licenciatura', 'value' => function ($dataProvider) {
    $student = \app\models\Student::findOne(['user_id' => $dataProvider->user_id]);
    $degree = \app\models\Degree::findOne(['id' => $student->degree_id]);
    return $degree->name;
}], ['attribute' => 'Facultad', 'value' => function ($dataProvider) {
    $faculty = \app\models\Faculty::findOne(['id' => $dataProvider->faculty_id]);
    return $faculty->name;
}], 'current_semester', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'user_id' => $model['user_id']], ['title' => Yii::t('app', 'Delete'), 'data-confirm' => Yii::t('app', '¿Estas seguro que deseas eliminar?'), 'data-method' => 'post']);
}]]]]);
?>

</div>
Пример #5
0
 public function getDegrees()
 {
     return $this->hasMany(Degree::className(), ['id' => 'degree_id'])->viaTable('student_profile', ['project_id' => 'id']);
 }
Пример #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDegree()
 {
     return $this->hasOne(Degree::className(), ['id' => 'degree_id']);
 }
Пример #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDegrees()
 {
     return $this->hasMany(Degree::className(), ['faculty_id' => 'id']);
 }
Пример #8
0
                <div class="panel-body">
                    <?php 
$form = ActiveForm::begin();
?>

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

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

                    <?php 
Modal::begin(['header' => '<h2>Perfiles solicitados</h2>', 'toggleButton' => ['label' => 'Perfiles solicitados', 'class' => 'btn btn-success']]);
echo $form->field($model, 'degrees1')->checkboxList(ArrayHelper::map(Degree::find()->all(), 'id', 'name'));
Modal::end();
?>

                    <br><br>

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


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

                    <?php 
Пример #9
0
?>
                </div>

                <div class="col-md-6">
                    <?php 
echo $form->field($model, 'id')->label('ID del proyecto');
?>
                </div>

            </div>

            <div class="row">

                <div class="col-md-6">
                    <?php 
echo $form->field($model, 'degree_id')->label('Licenciatura')->dropDownList(ArrayHelper::map(Degree::find()->all(), 'id', 'name'));
?>
                </div>

            </div>

            <div class="form-group">
                <?php 
echo Html::submitButton('Buscar', ['class' => 'btn btn-primary pull-right']);
?>
            </div>

            <?php 
ActiveForm::end();
?>
Пример #10
0
 /**
  * @return mixed|\yii\web\Response
  */
 public function actionPrintProjectAssignmentPDF()
 {
     $student = Student::findOne(['user_id' => Yii::$app->user->id]);
     date_default_timezone_set("America/Mexico_City");
     try {
         $registration = Registration::findOne(['student_id' => $student->id]);
         $person = Person::findOne(User::findOne(Yii::$app->user->id)->person_id);
         $degree = Degree::findOne($student->degree_id);
         $project = Project::findOne($registration->project_id);
         $projectM = ProjectManager::findOne($project->manager_id);
         // get your HTML raw content without any layouts or scripts
         $content = $this->render('projectAssignmentPDF', ['registration' => $registration, 'student' => $student, 'person' => $person, 'degree' => $degree, 'project' => $project, 'projectM' => $projectM]);
         $formatter = \Yii::$app->formatter;
         // setup kartik\mpdf\Pdf component
         $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_LETTER, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Carta de Asignación'], 'methods' => ['SetFooter' => ['Fecha de expedición: ' . $formatter->asDate(date('Y-m-d'), 'long')]]]);
         // return the pdf output as per the destination setting
         return $pdf->render();
     } catch (InvalidConfigException $e) {
         Yii::$app->getSession()->setFlash('danger', 'No tienes proyectos asignados');
         return $this->redirect(Url::home());
     }
 }