Exemple #1
0
 public function beforeAction($action)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status = 1');
     $criteria->addCondition('created_by = ' . Yii::app()->user->getInfo());
     $this->servicesArray = Services::model()->findAll($criteria);
     $arrayForSettings = array();
     $Settings = Settings::model()->findAll();
     foreach ($Settings as $key => $val) {
         $arrayForSettings[$val->setting_name] = $val->setting_value;
     }
     self::$settings = $arrayForSettings;
     $this->pageTitle = Yii::app()->name;
     $this->pageName = 'Account';
     $this->pageClass = 'blue';
     Yii::app()->session['securityCheck'] = md5(ip2long(Yii::app()->request->userHostAddress) + date("Y"));
     /* @var $cs CClientScript */
     $cs = Yii::app()->clientScript;
     // register jQuery script
     $cs->registerPackage('jquery');
     // register bootstrap script
     $cs->registerPackage('bootstrap');
     // If application is using a theme, replace default layout controller variable that start with '//layouts/' with a theme link
     if (empty(Yii::app()->theme->name) == false && isset($this->layout) == true && strpos($this->layout, '//layouts/') === 0) {
         // Replace path with slash by dot.
         $sThemeLayout = 'webroot.themes.' . Yii::app()->theme->name . '.views.layouts.' . str_replace('/', '.', substr($this->layout, 10));
         // If theme override given layout, get it from theme
         if ($this->getLayoutFile($sThemeLayout) !== false) {
             $this->layout = $sThemeLayout;
         }
     }
     return true;
 }
 public function actionSchedule()
 {
     $this->hasPrivilege(Acl::ACTION_VIEW);
     $this->pageTitle = Lang::t(Common::pluralize($this->resourceLabel));
     $client = Yii::app()->user->client != 0 ? "sp_client = " . (int) Yii::app()->user->client : "";
     $searchModel = Services::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'service_name', $client);
     $this->render('index', array('model' => $searchModel));
 }
 /**
  * Load Services model
  * @param integer $id
  * @return Services
  * @throws CHttpException
  */
 protected function loadModel($id = null)
 {
     if (null === $id) {
         $model = new Services();
     } else {
         $model = Services::model()->findByPk($id);
     }
     if ($model instanceof CModel) {
         $model->titleField = 'name';
         return $model;
     }
     throw new CHttpException(404, 'Item not found');
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->pagename = "Create " . $this->pagename;
     $model = new Appointments();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Appointments'])) {
         $model->attributes = $_POST['Appointments'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     if (isset($_GET['appointmentdate'])) {
         $model->start_datetime = $_GET['appointmentdate'];
     }
     $this->render('create', array('model' => $model, 'providers_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Providers::model()->findAll("id in (select providers_id from workers where users_id=" . Yii::app()->user->id . ")"), "id", 'name')), 'services_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Services::model()->findAll(), "id", 'name')), 'workers_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Users::model()->findAll('id in (select userid from AuthAssignment where ' . 'itemname="technician" and userid in ' . '(select users_id from workers where providers_id in ' . '(select providers_id from workers where users_id=' . Yii::app()->user->id . ')))'), "id", 'email')), 'users_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Users::model()->findAll('id in (select userid from AuthAssignment where ' . 'itemname="client")'), "id", 'email'))));
 }
 private function generalEnquiries()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/settings-general-enquiries.css");
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/settings-general-enquiries.js", CClientScript::POS_END);
     //settings starts
     $componentSettings = new ComponentSettings();
     $settingsArray = $componentSettings->show(Yii::app()->user->getInfo(), 'enquiries');
     //settings ends
     $criteria = new CDbCriteria();
     $criteria->addCondition('created_by = ' . Yii::app()->user->getInfo());
     $criteria->addCondition('status = 1');
     $eventsArray = RequestEvent::model()->findAll($criteria);
     //        $criteria = new CDbCriteria();
     //        $criteria->addCondition('created_by = '.Yii::app()->user->getInfo());
     //        $criteria->addCondition('status = 1');
     $servicesArray = Services::model()->findAll($criteria);
     $this->render('general/enquiries', array('settingsArray' => $settingsArray, 'eventsArray' => $eventsArray, 'servicesArray' => $servicesArray));
 }
 public function getAmountName($id)
 {
     if (empty($id)) {
         return NULL;
     }
     $name = Services::model()->getScaler('cost', '`service_id`=:t1 ', array(':t1' => $id));
     return !empty($name) ? $name / 100 : NULL;
 }
 public function actionService()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/request-service.css");
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/request-service-resp.css");
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/request-service.js", CClientScript::POS_END);
     if (Yii::app()->request->isPostRequest) {
         $service = (int) Yii::app()->request->getPost('service', 0);
         $timeStart = Yii::app()->request->getPost('timeStart', 0);
         $timeEnd = Yii::app()->request->getPost('timeEnd', 0);
         if ($service > 0) {
             $model = Services::model()->findByPk($service);
             $model->request_id = $this->_model->id;
             if ($model->save()) {
                 $criteria = new CDbCriteria();
                 $criteria->addCondition('created_by = ' . Yii::app()->user->getInfo());
                 $criteria->addCondition('id != ' . $model->id);
                 $modelArray = Services::model()->findAll($criteria);
                 foreach ($modelArray as $model) {
                     $model->request_id = null;
                     $model->save();
                 }
             }
         }
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition('status = 1');
     $criteria->addCondition('created_by = ' . Yii::app()->user->getInfo());
     if ($serviceId = (int) Yii::app()->request->getParam('list')) {
         $criteria->addCondition('id = ' . $serviceId);
         $services['one'] = Services::model()->findAll($criteria);
     } else {
         $services = Services::model()->findAll($criteria);
     }
     $this->render('service', array('model' => $this->_model, 'services' => $services));
 }
 /**
  * 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 $id the ID of the model to be loaded
  * @return Services the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Services::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #9
0
?>
        </div>
    </div>
</div>
<div id="main-column" <?php 
echo $layoutManager->columnWidthStyleAttr(1);
?>
>
    <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'services-form', 'enableAjaxValidation' => false, 'action' => array('saveChanges', 'id' => $model->id)));
$this->widget('DetailView', array('model' => $model));
//   $this->renderPartial('application.components.views.@DETAILVIEW', array('model' => $model, 'form' => $form, 'modelName' => 'services'));
?>

    <?php 
$childCases = Services::model()->findAllByAttributes(array('parentCase' => $model->id));
?>
    <?php 
if ($childCases) {
    ?>
        <div id="service-child-case-wrapper" class="x2-layout form-view">
            <div class="formSection showSection">
                <div class="formSectionHeader">
                    <span class="sectionTitle"><?php 
    echo Yii::t('services', 'Child Cases');
    ?>
</span>
                </div>
                <div id="parent-case" class="tableWrapper" style="min-height: 75px; padding: 5px;">
                    <?php 
    $comma = false;
Exemple #10
0
	<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'registered-profiles-registerProfile-form', 'enableAjaxValidation' => false));
?>

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

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($sr_model, 'serviceId');
?>
		<?php 
echo $form->dropDownList($sr_model, 'serviceId', CHtml::listData(Services::model()->findAll(), 'id', 'serviceName'));
?>
		<?php 
echo $form->error($sr_model, 'serviceId');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'firstname');
?>
		<?php 
echo $form->textField($model, 'firstname');
?>
		<?php 
echo $form->error($model, 'firstname');
 public function actionManageservices($id)
 {
     $this->pagename = "Manage " . $this->pagename . " Services";
     if (isset($_POST['serviceid'])) {
         $serviceids = $_POST['serviceid'];
         $servicecosts = $_POST['servicecost'];
         for ($i = 0; $i < count($serviceids); $i++) {
             $newservice = new ServicesProviders();
             $ser = ServicesProviders::model()->find("providers_id={$id} and services_id={$serviceids[$i]}");
             if ($ser) {
                 $newservice = $ser;
             }
             $newservice->providers_id = $id;
             $newservice->services_id = $serviceids[$i];
             $newservice->cost = $servicecosts[$i];
             if ($newservice->save()) {
                 echo "success";
             } else {
                 print_r($newservice->getError(true));
                 echo "failed";
             }
         }
     }
     $services = Services::model()->findAll();
     $provider_services = ServicesProviders::model()->findAll("providers_id={$id}");
     var_dump(count($provider_services));
     $res = array();
     foreach ($services as $service) {
         $temp = array();
         $temp['id'] = $service['id'];
         $temp['name'] = $service['name'];
         $temp['cost'] = "";
         $temp['checked'] = false;
         $temp['duration'] = "";
         $temp['description'] = "";
         foreach ($provider_services as $provider_service) {
             if ($service['id'] == $provider_service['services_id']) {
                 $temp['cost'] = $provider_service['cost'];
                 $temp['checked'] = true;
                 $temp['duration'] = $provider_service['duration'];
                 $temp['description'] = $provider_service['description'];
                 break;
             }
         }
         $res[] = $temp;
     }
     //var_dump($res);
     $this->render('managerservice', array('services' => $res, 'providerid' => $id));
 }
 public function actionServices()
 {
     $id = getCurCusId();
     if (isset($_POST['services']) && $_POST['services'] == 1) {
         if (isset($_POST['likeservices']) && $id) {
             Customer::model()->updateByPk($id, array('services' => CJSON::encode($_POST['likeservices'])));
         }
         $this->redirect(array('customer/Customerreply/' . $id));
         exit;
     }
     $this->customerData = Customer::model()->findByPk($id);
     $services = Services::model()->findAll('enable=:enable', array(':enable' => 1));
     $this->render('services', array('services' => $services, 'id' => $id));
 }