当前位置: 首页>>代码示例>>PHP>>正文


PHP Students::model方法代码示例

本文整理汇总了PHP中Students::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Students::model方法的具体用法?PHP Students::model怎么用?PHP Students::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Students的用法示例。


在下文中一共展示了Students::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 /**
  *
  *  Переобъявляем сохранение
  *
  **/
 public function save()
 {
     $student = Students::model()->findByPk(Yii::app()->my->id);
     $student->settings = json_encode($this->_attributes);
     $student->save();
     $_SESSION["settings"] = $student->settings;
 }
开发者ID:Kapodastr,项目名称:grow,代码行数:12,代码来源:Settings.php

示例2: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     if (isset($_POST['idProfile']) && isset($_POST['idEssay']) && isset($_POST['stardate']) && isset($_POST['enddate'])) {
         if (!empty($_POST['idProfile']) && !empty($_POST['idEssay']) && !empty($_POST['stardate']) && !empty($_POST['enddate'])) {
             $essay = $this->loadModel($id);
             $model = new EssaysHasCrugeUser();
             $idStudent = Students::model()->find('profile_id=' . $_POST['idProfile'])->id;
             $model->status = 1;
             $model->stardate = strtotime($_POST['stardate']);
             $model->enddate = strtotime($_POST['enddate']);
             $model->essays_id = $_POST['idEssay'];
             $model->title_essay = $essay->getNameTitleEssay($idStudent, $essay->colleges_has_majors_colleges_id, $essay->type_essay_id, $_POST['idEssay']);
             $model->students_id = $idStudent;
             /* echo "<pre>";
                echo print_r($model->enddate);
                echo "</pre>";
                Yii::app()->end(); */
             if ($model->save()) {
                 Yii::app()->user->setFlash('save', 'El Estudiante se ha agregado correctamente.');
                 $this->redirect(array('view', 'id' => $model->essays_id));
             }
         }
         Yii::app()->user->setFlash('error', 'Debe seleccionar un Estudiante, la fecha de inicio y culminación del Essay.');
         $this->redirect(array('view', 'id' => $_POST['idEssay']));
     }
     $this->render('view', array('model' => $this->loadModel($id)));
 }
开发者ID:argenis1763,项目名称:vc,代码行数:31,代码来源:EssaysController.php

示例3: studentname

 public function studentname($data, $row)
 {
     $student = Students::model()->findByAttributes(array('id' => $data->student_id));
     if ($student != NULL) {
         return ucfirst($student->first_name) . ' ' . ucfirst($student->last_name);
     } else {
         return '-';
     }
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:9,代码来源:ExamScores.php

示例4: actionBatch

 public function actionBatch()
 {
     if (isset($_POST['batch'])) {
         $data = Students::model()->findAll('batch_id=:x', array(':x' => $_POST['batch']));
     }
     // echo CHtml::tag('option', array('value' => 0), CHtml::encode('Select'), true);
     $data = CHtml::listData($data, 'id', 'phone1');
     foreach ($data as $phoneno) {
         if ($phoneno != "") {
             echo $phoneno;
             echo ",";
         }
     }
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:14,代码来源:SendbatchController.php

示例5: actionAddpoint

 public function actionAddpoint($id)
 {
     $student = Students::model()->findByPk($id);
     $bonus = new Points();
     if (isset($_REQUEST['Points'])) {
         $data = $_REQUEST['Points'];
         $bonus->student = $data['student'];
         $bonus->earned = $data['earned'];
         $bonus->comment = $data['comment'];
         $bonus->by = $data['by'];
         if ($bonus->save()) {
             Yii::app()->notify->add("Бонус добавлен");
         } else {
             Yii::app()->notify->addErrors($bonus->getErrors());
         }
     }
     $this->render('addpoint', array('student' => $student, "point" => $bonus));
 }
开发者ID:Kapodastr,项目名称:grow,代码行数:18,代码来源:StudentsController.php

示例6: actionStudent

 public function actionStudent()
 {
     if (isset($_POST['studentuser'])) {
         $students = Students::model()->findAll(array('condition' => 'uid=:x and is_deleted=:y', 'params' => array(':x' => 0, ':y' => 0), 'limit' => '1000', 'order' => 'id ASC'));
         if ($students != NULL) {
             foreach ($students as $student) {
                 $user = new User();
                 $profile = new Profile();
                 if ($student->email != NULL) {
                     $user->username = substr(md5(uniqid(mt_rand(), true)), 0, 10);
                     $user->email = $student->email;
                     $user->activkey = UserModule::encrypting(microtime() . $student->first_name);
                     $password = substr(md5(uniqid(mt_rand(), true)), 0, 10);
                     $user->password = UserModule::encrypting($password);
                     $user->superuser = 0;
                     $user->status = 1;
                     if ($user->save()) {
                         //assign role
                         $authorizer = Yii::app()->getModule("rights")->getAuthorizer();
                         $authorizer->authManager->assign('student', $user->id);
                         //profile
                         $profile->firstname = $student->first_name;
                         $profile->lastname = $student->last_name;
                         $profile->user_id = $user->id;
                         $profile->save();
                         //saving user id to students table.
                         $student->saveAttributes(array('uid' => $user->id));
                         UserModule::sendMail($student->email, UserModule::t("You are registered from {site_name}", array('{site_name}' => Yii::app()->name)), UserModule::t("Please login to your account with your email id as username and password {password}", array('{password}' => $password)));
                         $flash = "User created successfully";
                         $type = 'success';
                     }
                 } else {
                     $flash = "No email id given";
                     $type = 'error';
                 }
             }
         }
         Yii::app()->user->setFlash($type, $flash);
         $this->redirect(array('/importcsv'));
     } else {
         $this->render('/default/student');
     }
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:43,代码来源:UsersController.php

示例7: actionIndex

 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = '';
     $roles = Rights::getAssignedRoles(Yii::app()->user->id);
     // check for single role
     $user_roles = array();
     foreach ($roles as $role) {
         $user_roles[] = '"' . $role->name . '"';
     }
     $student = Students::model()->findByAttributes(array('uid' => Yii::app()->user->id));
     $batch = Batches::model()->findByAttributes(array('id' => $student->batch_id));
     $criteria->condition .= '`file`<>:null AND (`placeholder`=:null OR `placeholder` IN (' . implode(',', $user_roles) . ')) AND ((`course` IS NULL) OR (`course`=:course) OR (`course`=0)) AND ((`batch` IS NULL) OR (`batch`=:batch) OR (`batch`=0))';
     $criteria->params = array(':null' => '', ':course' => $batch->course_id, ':batch' => $batch->id);
     $criteria->order = '`created_at` DESC';
     //print_r($criteria); exit;
     $files = FileUploads::model()->findAll($criteria);
     if (isset($_POST['Downfiles'])) {
         $selected_files = $_POST['Downfiles'];
         $slfiles = array();
         foreach ($selected_files as $s_file) {
             $model = FileUploads::model()->findByPk($s_file);
             if ($model != NULL) {
                 $slfiles[] = 'uploads/shared/' . $model->id . '/' . $model->file;
             }
         }
         $zip = Yii::app()->zip;
         $fName = $this->generateRandomString(rand(10, 20)) . '.zip';
         $zipFile = 'compressed/' . $fName;
         if ($zip->makeZip($slfiles, $zipFile)) {
             $fcon = file_get_contents($zipFile);
             header('Content-type:text/plain');
             header('Content-disposition:attachment; filename=' . $fName);
             header('Pragma:no-cache');
             echo $fcon;
             unlink($zipFile);
         } else {
             Yii::app()->user->setFlash('success', 'Can\'t download');
         }
     }
     $this->render('/fileUploads/index', array('files' => $files));
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:47,代码来源:StudentsController.php

示例8: actionAddguardian

 public function actionAddguardian()
 {
     $model = new Guardians();
     if (isset($_POST['Guardians'])) {
         $list = $_POST['Guardians'];
         $student = Students::model()->findByAttributes(array("id" => $list['ward_id']));
         $student->immediate_contact_id = $list['radio'];
         $student->save();
         $this->redirect(array('studentPreviousDatas/create', 'id' => $list['ward_id']));
         //$this->redirect(array('students/view','id'=>$list['ward_id']));
     }
     $this->render('addguardian', array('model' => $model));
 }
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:13,代码来源:GuardiansController.php

示例9: getNameTitleEssay

 public function getNameTitleEssay($id, $idColleges, $idTypeEssay, $idEssay)
 {
     $numEssay = EssaysHasCrugeUser::model()->calcularEssay($id, $idEssay, $idColleges, $idTypeEssay);
     return Students::model()->getNameShort($id) . "-" . $this->getNameFileEssay($idColleges, $idTypeEssay) . $numEssay;
 }
开发者ID:argenis1763,项目名称:vc,代码行数:5,代码来源:Essays.php

示例10: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         $model = ExamScores::model()->findByAttributes(array('id' => $id));
         $student = Students::model()->findByAttributes(array('id' => $model->student_id));
         $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name);
         $exam = Exams::model()->findByAttributes(array('id' => $model->exam_id));
         $subject_name = Subjects::model()->findByAttributes(array('id' => $exam->subject_id));
         $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id));
         $batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id));
         $exam_name = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')';
         $goal_name = $student_name . ' for the exam ' . $exam_name;
         // we only allow deletion via POST request
         $this->loadModel($id)->delete();
         //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
         ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '22', $model->id, $goal_name, NULL, NULL, NULL);
         // we only allow deletion via POST request
         //$this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:31,代码来源:ExamScoresController.php

示例11: count

        <?php 
        $course = Courses::model()->findByAttributes(array('id' => $batch->course_id));
        if ($course != NULL) {
            echo $course->course_name;
        }
        ?>
</span>
      
    </li>
    </ul>
     <div class="clear"></div>
    </div>
    <div class="status_bx">
    	<ul>
        	<li style="border-right:1px #d9e1e7 solid"><span><?php 
        echo count(Students::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])));
        ?>
</span><?php 
        echo Yii::t('Batch', 'Students');
        ?>
</li>
            <li style="border-left:1px #fff solid;border-right:1px #d9e1e7 solid;"><span><?php 
        echo count(Subjects::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id'])));
        ?>
</span><?php 
        echo Yii::t('Batch', 'Subjects');
        ?>
</li>
            <li style="border-left:1px #fff solid"><span><?php 
        echo count(TimetableEntries::model()->findAll(array('condition' => 'batch_id=:x', 'group' => 'employee_id', 'params' => array(':x' => $_REQUEST['id']))));
        ?>
开发者ID:SoftScape,项目名称:open-school-CE,代码行数:31,代码来源:left_side.php

示例12: foreach

        ?>
                	<td style="width:auto; min-width:80px; text-align:center;"><?php 
        if (count($list) > 7) {
            echo @$subject->code;
        } else {
            echo @$subject->name;
        }
        ?>
</td>
                <?php 
    }
    ?>
            </tr>
            <!-- End Table Headers -->
            <?php 
    $students = Students::model()->findAllByAttributes(array('batch_id' => $batch_id, 'is_deleted' => 0, 'is_active' => 1));
    if (isset($students) and $students != NULL) {
        foreach ($students as $student) {
            ?>
					<tr class=<?php 
            echo $cls;
            ?>
>
						<td>
							<?php 
            echo $student->admission_no;
            ?>
						</td>
						<td>
							<?php 
            echo CHtml::link(ucfirst($student->first_name) . '  ' . ucfirst($student->middle_name) . '  ' . ucfirst($student->last_name), array('/students/students/view', 'id' => $student->id));
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:31,代码来源:assessmentsms.php

示例13: actionStudentindividualpdf

 public function actionStudentindividualpdf()
 {
     $student_name = Students::model()->findByAttributes(array('id' => $_REQUEST['student']));
     $pdf_name = ucfirst($student_name->first_name) . ' ' . ucfirst($student_name->last_name) . ' Student Attendance Report.pdf';
     # HTML2PDF has very similar syntax
     $html2pdf = Yii::app()->ePdf->HTML2PDF();
     $html2pdf->WriteHTML($this->renderPartial('studentindividualpdf', array(), true));
     $html2pdf->Output($pdf_name);
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:9,代码来源:DefaultController.php

示例14: getStudentadm

 public function getStudentadm()
 {
     $student = Students::model()->findByAttributes(array('id' => $this->student_id));
     return $student->admission_no;
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:5,代码来源:BorrowBook.php

示例15: actionAutocomplete1

 public function actionAutocomplete1()
 {
     if (isset($_GET['term'])) {
         $criteria = new CDbCriteria();
         $criteria->alias = "last_name";
         $criteria->condition = "last_name   like '%" . $_GET['term'] . "%'";
         $userArray = Students::model()->findAll($criteria);
         $hotels = Students::model()->findAll($criteria);
         $return_array = array();
         foreach ($hotels as $hotel) {
             $return_array[] = array('label' => $hotel->last_name . ' ' . $hotel->first_name, 'value' => $hotel->last_name, 'id' => $hotel->id);
         }
         echo CJSON::encode($return_array);
     }
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:15,代码来源:TransportationController.php


注:本文中的Students::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。