# User if (cntData("SELECT ID FROM " . $db_prefix . "users") == 0) { $opOr = $myconn->query("SELECT ID FROM " . $db_prefix . "organizations"); $opOrRs = $opOr->fetch_assoc(); $usrLethe = new lethe(); $usrLethe->onInstall = true; $usrLethe->isMaster = 1; $usrLethe->auth_mode = 2; $usrLethe->isPrimary = 1; $usrLethe->OID = $opOrRs['ID']; $usrLethe->addUser(); } # Main Cron $letChr = new Crontab(); $mainCroner = "* * * * * curl -s '" . lethe_root_url . "chronos/lethe.php' >/dev/null 2>&1"; $letChr->addJob($mainCroner); die('<script>$("#myLethe").attr("disabled",true);</script>' . errMod('Lethe Successfully Installed on Your System!<br>Dont Forget to Remove <strong>install.php</strong> File!', 'success')); } else { die('<script>$("#myLethe").attr("disabled",false);</script>' . errMod($errors, 'danger')); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Lethe Newsletter & Mailing System Installation</title> <!-- styles -->
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model=$this->loadModel($id); // comment the following line if AJAX validation is not needed $this->performAjaxValidation($model); if(isset($_POST['ScheduleTiming'])) { $model->attributes=$_POST['ScheduleTiming']; if($model->schedule_timing_minute==60) { $minute="*"; } else { $minute=$model->schedule_timing_minute; } if($model->schedule_timing_hour==24) { $hour="*"; } else { $hour=$model->schedule_timing_hour; } if($model->schedule_timing_date==32) { $date="*"; } else { $date=$model->schedule_timing_date; } $days=array("Sunday"=>7,"Monday"=>1,"Tuesday"=>2,"Wednesday"=>3,"Thursday"=>4,"Friday"=>5,"Saturday"=>6,"*"=>"*"); $day=$days[$model->schedule_timing_day]; $months=array('January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>9,'October'=>10,'November'=>11,'December'=>12,'*'=>'*'); $month=$months[$model->schedule_timing_month]; $model->schedule_timing_name=$minute."-".$hour."-".$date."-".$model->schedule_timing_month."-".$model->schedule_timing_day; if($model->save()) { $crons=StudentSmsEmailDetails::model()->findAll(array('condition'=>'student_sms_email_details_schedule_time_id='.$model->schedule_timing_id)); $j = count($crons); $i = 0; foreach($crons as $cron) { if($cron->student_sms_email_details_purpose=="fees") { $period=$cron->academic_period_id; $sem=$cron->academic_name_id; $branch=$cron->branch_id; $div=$cron->division_id; $purpose=$cron->student_sms_email_details_purpose; $message=$cron->message_email_text; $user=$cron->created_by; $to=$cron->student_sms_email_details_fees_msg_type; $mobile=$cron->student_sms_email_details_to_mobile; $cronid=$cron->student_sms_email_details_cron_no-$i; $mycron = new Crontab('my_crontab'); $jobs_obj = $mycron->getJobs(); $mycron->removeJob($cronid); $mycron->saveCronFile(); $mycron->saveToCrontab(); StudentSmsEmailDetails::model()->updateCounters(array('student_sms_email_details_cron_no'=>-1),'student_sms_email_details_cron_no>'.$cronid); $mycron = new Crontab('my_crontab'); $cron->student_sms_email_details_cron_no=((count($mycron->getJobs()))); $cron->save(); $mycron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic feesschedulesms '.$period." ".$sem." ".$branch." ".$div." ".$purpose." \"$message\" ".$user." ".$to." ".$mobile , $minute, $hour,$date,$month,$day); $mycron->saveCronFile(); $mycron->saveToCrontab(); } else { $period=$cron->academic_period_id; $sem=$cron->academic_name_id; $branch=$cron->branch_id; $div=$cron->division_id; $purpose=$cron->student_sms_email_details_purpose; $user=$cron->created_by; $mobile=$cron->student_sms_email_details_to_mobile; $cronid=$cron->student_sms_email_details_cron_no-$i; $mycron = new Crontab('my_crontab'); $jobs_obj = $mycron->getJobs(); $mycron->removeJob($cronid); $mycron->saveCronFile(); $mycron->saveToCrontab(); StudentSmsEmailDetails::model()->updateCounters(array('student_sms_email_details_cron_no'=>-1),'student_sms_email_details_cron_no>'.$cronid); $mycron = new Crontab('my_crontab'); $cron->student_sms_email_details_cron_no=(count($mycron->getJobs())); $cron->save(); $mycron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic attendance '.$period." ".$sem." ".$branch." ".$div." ".$purpose." ".$user." ".$mobile,$minute,$hour,$date,$month,$day); $mycron->saveCronFile(); $mycron->saveToCrontab(); } $i++; } $backup_crons=DatabaseBackupCron::model()->findAll(array('condition'=>'database_backup_cron_schedule_time_id='.$model->schedule_timing_id)); $j = count($backup_crons); $i = 0; foreach($backup_crons as $cron) { $cronid=$cron->database_backup_cron_no-$i; $mycron = new Crontab('backup_crontab'); $jobs_obj = $mycron->getJobs(); $mycron->removeJob($cronid); $mycron->saveCronFile(); $mycron->saveToCrontab(); DatabaseBackupCron::model()->updateCounters(array('database_backup_cron_no'=>-1),'database_backup_cron_no>'.$cronid); $mycron = new Crontab('backup_crontab'); $cron->database_backup_cron_no=((count($mycron->getJobs()))); $cron->save(); $mycron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic backup' , $minute, $hour,$date,$month,$day); $mycron->saveCronFile(); $mycron->saveToCrontab(); $i++; } $this->redirect(array('view','id'=>$model->schedule_timing_id)); } } $this->render('update',array( 'model'=>$model, )); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model=$this->loadModel($id); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if(!empty($_POST['StudentSmsEmailDetails'])) { $model->attributes=$_POST['StudentSmsEmailDetails']; $data=ScheduleTiming::model()->findByPk($model->student_sms_email_details_schedule_time_id); if($data->schedule_timing_minute==60) { $minute="*"; } else { $minute=$data->schedule_timing_minute; } if($data->schedule_timing_hour==24) { $hour="*"; } else { $hour=$data->schedule_timing_hour; } if($data->schedule_timing_date==32) { $date="*"; } else { $date=$data->schedule_timing_date; } $days=array("Sunday"=>7,"Monday"=>1,"Tuesday"=>2,"Wednesday"=>3,"Thursday"=>4,"Friday"=>5,"Saturday"=>6,"*"=>"*"); $day=$days[$data->schedule_timing_day]; $months=array('January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>9,'October'=>10,'November'=>11,'December'=>12,'*'=>'*'); $month=$months[$data->schedule_timing_month]; if(empty($course->student_sms_email_details_course_id)) { $course=0; $model->student_sms_email_details_course_id=0; } else $course= $model->student_sms_email_details_course_id; if(empty($batch->student_sms_email_details_batch_id)) { $batch=0; $model->student_sms_email_details_batch_id=0; } else $batch= $model->student_sms_email_details_batch_id; if($model->student_sms_email_details_schedule_flag==1 && $model->student_sms_email_details_purpose=="fees") { $cron = new Crontab('my_crontab'); $jobs_obj = $cron->getJobs(); $cron->removeJob($model->student_sms_email_details_cron_no); $cron->saveCronFile(); $cron->saveToCrontab(); $mobile=$model->student_sms_email_details_to_mobile; $cronid=$model->student_sms_email_details_cron_no; $purpose=$model->student_sms_email_details_purpose; $message=$model->message_email_text; $to=$model->student_sms_email_details_fees_msg_type; $userid=$model->created_by; StudentSmsEmailDetails::model()->updateCounters(array('student_sms_email_details_cron_no'=>-1),'student_sms_email_details_cron_no>'.$cronid); $cron = new Crontab('my_crontab'); $model->student_sms_email_details_cron_no=count($cron->getJobs()); $cron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic feesschedulesms '.$course." ".$batch." ".$purpose." \"$message\" ".$userid." ".$to." ".$mobile , $minute, $hour,$date,$month,$day); $cron->saveCronFile(); $cron->saveToCrontab(); if($model->save()) $this->redirect(array('scheduleMessages')); } else { $mobile=$model->student_sms_email_details_to_mobile; $purpose=$model->student_sms_email_details_purpose; $userid=$model->created_by; $cron = new Crontab('my_crontab'); $jobs_obj = $cron->getJobs(); $cron->removeJob($model->student_sms_email_details_cron_no); $cron->saveCronFile(); $cron->saveToCrontab(); $cronid=$model->student_sms_email_details_cron_no; StudentSmsEmailDetails::model()->updateCounters(array('student_sms_email_details_cron_no'=>-1),'student_sms_email_details_cron_no>'.$cronid); $cron = new Crontab('my_crontab'); // my_crontab file will store all added jobs $model->student_sms_email_details_cron_no=count($cron->getJobs()); $model->save(false); $cron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic attendance '.$course." ".$batch." ".$purpose." ".$userid." ".$mobile,$minute,$hour,$date,$month,$day); $cron->saveCronFile(); $cron->saveToCrontab(); if($model->save()) $this->redirect(array('scheduleMessages')); } } if($model->student_sms_email_details_schedule_flag==1 && $model->student_sms_email_details_purpose=="fees") { $this->render('schedulesms',array( 'model'=>$model, )); break; } if($model->student_sms_email_details_schedule_flag==1 && $model->student_sms_email_details_purpose=="attendance") { $this->render('attendanceMessage',array( 'model'=>$model, )); break; } $this->render('update',array( 'model'=>$model, )); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model=$this->loadModel($id); // comment the following line if AJAX validation is not needed $this->performAjaxValidation($model); if(isset($_POST['DatabaseBackupCron'])) { $model->attributes=$_POST['DatabaseBackupCron']; $data=ScheduleTiming::model()->findByPk($model->database_backup_cron_schedule_time_id); if($data->schedule_timing_minute==60) { $minute="*"; } else { $minute=$data->schedule_timing_minute; } if($data->schedule_timing_hour==24) { $hour="*"; } else { $hour=$data->schedule_timing_hour; } if($data->schedule_timing_date==32) { $date="*"; } else { $date=$data->schedule_timing_date; } $days=array("Sunday"=>7,"Monday"=>1,"Tuesday"=>2,"Wednesday"=>3,"Thursday"=>4,"Friday"=>5,"Saturday"=>6,"*"=>"*"); $day=$days[$data->schedule_timing_day]; $months=array('January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>9,'October'=>10,'November'=>11,'December'=>12,'*'=>'*'); $month=$months[$data->schedule_timing_month]; $cronid=$model->database_backup_cron_no; $cron = new Crontab('backup_crontab'); $jobs_obj = $cron->getJobs(); $cron->removeJob($model->database_backup_cron_no); $cron->saveCronFile(); $cron->saveToCrontab(); DatabaseBackupCron::model()->updateCounters(array('database_backup_cron_no'=>-1),'database_backup_cron_no>'.$cronid); $cron = new Crontab('backup_crontab'); $model->database_backup_cron_no=count($cron->getJobs()); $cron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic backup' , $minute, $hour,$date,$month,$day); $cron->saveCronFile(); $cron->saveToCrontab(); if($model->save()) $this->redirect(array('view','id'=>$model->database_backup_cron_id)); } $this->render('update',array( 'model'=>$model, )); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model=$this->loadModel($id); // comment the following line if AJAX validation is not needed $this->performAjaxValidation($model); if(isset($_POST['StudentAttendenceEmail'])) { $model->attributes=$_POST['StudentAttendenceEmail']; if(empty($model->student_attendence_email_branch_id)) { $branch=0; $model->student_attendence_email_branch_id=0; } else $branch= $model->student_attendence_email_branch_id; if($model->save()) { $cron = new Crontab('mail_crontab'); $jobs_obj = $cron->getJobs(); $cron->removeJob($model->student_attendence_email_cron_no); $cron->saveCronFile(); $cron->saveToCrontab(); $emp=$model->student_attendence_email_emp_id; $cronid=$model->student_attendence_email_cron_no; $orgid=$model->student_attendence_email_org_id; StudentAttendenceEmail::model()->updateCounters(array('student_attendence_email_cron_no'=>-1),'student_attendence_email_cron_no>'.$cronid); $cron = new Crontab('mail_crontab'); $model->student_attendence_email_cron_no=count($cron->getJobs()); $cron->addJob(Yii::getPathOfAlias('webroot').'/protected/yiic attendancemail '.$orgid." ".$branch." ".$emp , $model->student_attendence_email_minute, $model->student_attendence_email_hour,"*","*","1-6"); $cron->saveCronFile(); $cron->saveToCrontab(); $this->redirect(array('view','id'=>$model->student_attendence_email_id)); } } $emp_data =array($model->student_attendence_email_emp_id); $this->render('branch_selection',array('list'=>$emp_data,'model'=>$model)); }