示例#1
0
	$model->database_backup_cron_id,
);
?>
<div class="portlet box blue">
<i class="icon-reorder"></i>
 <div class="portlet-title"><span class="box-title">View Schedule Database Backup</span>
<div class="operation">
<?php echo CHtml::link('Back', array('admin'), array('class'=>'btnback'));?>
<?php echo CHtml::link('Edit', array('update' ,'id'=>$model->database_backup_cron_id), array('class'=>'btnupdate'));?>
<?php echo CHtml::link('Delete', array('delete' ,'id'=>$model->database_backup_cron_id), array('class'=>'btndelete','onclick'=>"return confirm('Are you sure want to delete?');"));?>
</div>
 </div>
<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		array(
		  'name'=>'database_backup_cron_schedule_time_id',
		  'value'=>ScheduleTiming::model()->findByPk($model->database_backup_cron_schedule_time_id)->schedule_timing_name,
		),
		array(
		   'name'=>'database_backup_cron_created_by',
		   'value'=>User::model()->findByPk($model->database_backup_cron_created_by)->user_organization_email_id,
	),	
		array(
		   'name'=>'database_backup_cron_creation_date',
		   'value'=>($model->database_backup_cron_creation_date == 0000-00-00) ? 'Not Set' : date_format(new DateTime($model->database_backup_cron_creation_date), 'd-m-Y'),
	),
	),
	'htmlOptions'=> array('class'=>'custom-view'),
)); ?>
			'type'=>'POST', 
			'url'=>CController::createUrl('dependent/getSmsEmailBatch'), 
	
			'update'=>'#StudentSmsEmailDetails_student_sms_email_details_batch_id', //selector to update
			))); ?><span class="status">&nbsp;</span>
		<?php echo $form->error($model,'student_sms_email_details_course_id'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'student_sms_email_details_batch_id'); ?>
		<?php echo $form->dropDownList($model,'student_sms_email_details_batch_id',array(), array('empty' => 'Select Batch')); ?><span class="status">&nbsp;</span>
		<?php echo $form->error($model,'student_sms_email_details_course_id'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'student_sms_email_details_schedule_time_id'); ?>
		<?php echo $form->dropDownList($model,'student_sms_email_details_schedule_time_id',CHtml::listData(ScheduleTiming::model()->findAll(),'schedule_timing_id','schedule_timing_name'),array('empty'=>'Select Schedule')); ?>
		<span class="status">&nbsp;</span>
		<?php echo $form->error($model,'student_sms_email_details_schedule_time_id'); ?>
	</div>
	
	<div class="row">
		<?php echo CHtml::label(Yii::t('student_sms_email_details_to_mobile', 'To <span class="required">*</span>'), 'Email');?>
 		<?php $data = array('1'=>"Student Mobile",'2'=>"Guardian Mobile");
		 echo $form->radioButtonList($model,'student_sms_email_details_to_mobile',$data,array( 'labelOptions'=>array('style'=>'display:inline;width:45px;'), 'template'=>"{input} {label}", 'separator'=>'&nbsp;&nbsp;&nbsp;'));?>		
		<span class="status">&nbsp;</span>
		<?php echo $form->error($model,'student_sms_email_details_to_mobile'); ?>
	</div>	
	<div class="row">
		<?php echo $form->labelEx($model,'message_email_text'); ?>
		<?php echo $form->textArea($model,'message_email_text',array('rows'=>4, 'cols'=>50,'placeholder'=>"student first name is absent on lecture no 1:subject_name,please do needful.",'disabled'=>'true','style'=>'float:left')); ?>
		<span class="status">&nbsp;</span>
示例#3
0
<div class="portlet box blue">
<i class="icon-reorder"></i>
<div class="portlet-title"><span class="box-title">Schedule Database Backup</span>
</div>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'database-backup-cron-form',
	'enableAjaxValidation'=>true,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<div class="row">
		<?php echo $form->labelEx($model,'database_backup_cron_schedule_time_id'); ?>
		<?php echo $form->dropDownList($model,'database_backup_cron_schedule_time_id',CHtml::listData(ScheduleTiming::model()->findAll(),'schedule_timing_id','schedule_timing_name'),array('empty'=>'Select Schedule')); ?>
		<span class="status">&nbsp;</span>
		<?php echo $form->error($model,'database_backup_cron_schedule_time_id'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Add' : 'Save',array('class'=>'submit')); ?>
		<?php echo CHtml::link('Cancel', array('admin'), array('class'=>'btnCan')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
</div>
	/**
	 * Returns the data model based on the primary key given in the GET variable.
	 * If the data model is not found, an HTTP exception will be raised.
	 * @param integer the ID of the model to be loaded
	 */
	public function loadModel($id)
	{
		$model=ScheduleTiming::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}
	<tr>
		<th >      SI No	</th>
		<th >   Schedule Time	</th>

 		<th >   Created By	</th>
 		<th >   Creation Date	</th>
 	</tr>

	<?php $i=0;
	foreach($model as $row=>$v): 
	 if($row <> 0) {
            ?>
	<tr>
        	<td>
			<?php echo ++$i; ?>
		</td>
	 	<td>
			<?php echo ScheduleTiming::model()->findByPk($v['database_backup_cron_schedule_time_id'])->schedule_timing_name; ?>
		</td>

       		<td>
			<?php echo User::model()->findByPk($v['database_backup_cron_created_by'])->user_organization_email_id;?>
		</td>
       		<td>
			<?php echo date_format(new DateTime($v['database_backup_cron_creation_date']), 'd-m-Y'); ?>
		</td>
       	       	</tr>
     <?php } endforeach; ?>
</table>
<?php endif; ?>
	/**
	 * 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);
    	   // 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,
		));
	}