/**
  * View the checklist
  *
  */
 function view()
 {
     if ($this->active_checklist->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_checklist->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     ProjectObjectViews::log($this->active_checklist, $this->logged_user);
     $this->addBreadcrumb(str_excerpt(clean($this->active_checklist->getName()), 10), mobile_access_module_get_view_url($this->active_checklist));
     $this->addBreadcrumb(lang('View'));
 }
Example #2
0
 public function actionGraficos()
 {
     $id = Yii::app()->request->getParam('id');
     $protecto = $this->loadModel($id);
     $barra = array();
     foreach ($protecto->localidads as $index => $localidad) {
         $barra['localidad']['nombre'][$index] = $localidad->comuna->nombre;
         $checklist = Checklist::model()->findAllByAttributes(array('localidad_id' => $localidad->id));
         $pendiente = 0;
         $iniciado = 0;
         $terminado = 0;
         foreach ($checklist as $check) {
             switch ($check->estado_id) {
                 case 1:
                     $pendiente++;
                     break;
                 case 2:
                     $iniciado++;
                     break;
                 case 3:
                     $terminado++;
                     break;
             }
         }
         $barra['localidad']['pendiente'][$index] = $pendiente;
         $barra['localidad']['iniciado'][$index] = $iniciado;
         $barra['localidad']['terminado'][$index] = $terminado;
     }
     $this->render('graficos', array('model' => $protecto, 'barra' => $barra));
 }
 function opentasks()
 {
     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     mysql_select_db(DB_NAME, $link);
     $query = "select * from healingcrystals_project_objects where parent_id='" . $this->active_checklist->getId() . "' and type='Task' and project_id='" . $this->active_project->getId() . "' and completed_on is not null";
     $result = mysql_query($query, $link);
     while ($info = mysql_fetch_assoc($result)) {
         $task = new Task($info['id']);
         $open = $task->open($this->logged_user);
         if ($open && !is_error($open)) {
             $updated++;
         }
     }
     mysql_close($link);
     $this->redirectToUrl($this->active_checklist->getViewUrl());
 }
<?php

//Imports
require_once 'db.php';
require_once 'Checklist.php';
if (!isset($_POST['id']) || !is_numeric($_POST['id'])) {
    http_response_code(422);
    echo 'Invalid list ID';
    exit;
}
$con = connect_db();
$employee = new Checklist();
$employee->id = intval($_POST['id']);
$employee->delete($con);
$con->close();
header('Location: ../checklists');
 public function actionCreateGrafic()
 {
     $ids = Yii::app()->request->getParam('proyectos');
     $barra = array();
     $torta = array();
     foreach ($ids as $index1 => $id) {
         $proyecto = Proyecto::model()->findByPk($id);
         $proyectos[$index1] = $proyecto->nombre;
         foreach ($proyecto->localidads as $index => $localidad) {
             $barra[$index1]['localidad']['nombre'][$index] = $localidad->comuna->nombre;
             $checklist = Checklist::model()->findAllByAttributes(array('localidad_id' => $localidad->id));
             $pendiente = 0;
             $iniciado = 0;
             $terminado = 0;
             foreach ($checklist as $check) {
                 switch ($check->estado_id) {
                     case 1:
                         $pendiente++;
                         break;
                     case 2:
                         $iniciado++;
                         break;
                     case 3:
                         $terminado++;
                         break;
                 }
             }
             $barra[$index1]['localidad']['pendiente'][$index] = $pendiente;
             $barra[$index1]['localidad']['iniciado'][$index] = $iniciado;
             $barra[$index1]['localidad']['terminado'][$index] = $terminado;
         }
         foreach ($proyecto->localidads as $index => $localidad) {
             $torta[$index1][$index]['localidad'] = $localidad->comuna->nombre;
             $count = count($localidad->checklists);
             $precio = 0;
             $costo = 0;
             foreach ($proyecto->tareas as $tarea) {
                 $precio = $precio + $tarea->precio;
                 $costo = $costo + $tarea->costo;
             }
             $precio = $precio * $count;
             $costo = $costo * $count;
             //$barra2[$index1]['localidad'][$index] = $localidad->comuna->nombre;
             $barra2[$index1]['precio'][$index] = $precio;
             $barra2[$index1]['costo'][$index] = $costo;
             $barra2[$index1]['ganancia'][$index] = $precio - $costo;
             foreach ($localidad->checklists as $checklist) {
                 if (isset($checklist->usuario_id)) {
                     $cant = 1;
                     if (isset($torta[$index1][$index]['checklist'][$checklist->usuario_id]['cant'])) {
                         $cant = $torta[$index1][$index]['checklist'][$checklist->usuario_id]['cant'];
                         $cant++;
                     }
                     $torta[$index1][$index]['checklist'][$checklist->usuario_id]['id'] = $checklist->usuario_id;
                     $torta[$index1][$index]['checklist'][$checklist->usuario_id]['nombre'] = $checklist->usuario->nombre;
                     $torta[$index1][$index]['checklist'][$checklist->usuario_id]['cant'] = $cant;
                 } else {
                     $cant = 1;
                     if (isset($torta[$index1][$index]['checklist']['otros']['cant'])) {
                         $cant = $torta[$index1][$index]['checklist']['otros']['cant'];
                         $cant++;
                     }
                     $torta[$index1][$index]['checklist']['otros']['id'] = 'otros';
                     $torta[$index1][$index]['checklist']['otros']['nombre'] = 'sin asignar';
                     $torta[$index1][$index]['checklist']['otros']['cant'] = $cant;
                 }
             }
         }
     }
     Yii::app()->clientScript->scriptMap['jquery.js'] = false;
     Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
     Yii::app()->clientScript->scriptMap['highcharts.js'] = false;
     Yii::app()->clientScript->scriptMap['exporting.js'] = false;
     header("Content-type: application/json");
     echo CJSON::encode(array('div' => $this->renderPartial('graficos', array('barras' => $barra, 'tortas' => $torta, 'proyectos' => $proyectos, 'barras2' => $barra2), true, true)));
     exit;
 }
 protected function createTestChecklist(array $attributes = [])
 {
     return Checklist::create($attributes + ['name' => 'Test Checklist']);
 }
Example #7
0
 public function actionChecklist()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('mstTeamUsers1.teamOwner_id = ' . Yii::app()->user->getInfo());
     $criteria->addCondition('mstTeamUsers1.status = 1');
     $criteria->with = array('mstTeamUsers1');
     $checklist_id = Yii::app()->getRequest()->getParam('list');
     $modelArray = Users::model()->findAll($criteria);
     $checklistModel = new Checklist();
     $checklistItemModel = new ChecklistItem();
     if (Yii::app()->getRequest()->isAjaxRequest && Yii::app()->getRequest()->getIsPostRequest()) {
         $checklist_item_id = Yii::app()->getRequest()->getParam('checklist_item_id');
         $checklist_item_chacke = Yii::app()->getRequest()->getParam('checklist_item_chack');
         $checklistItemModel->updateByPk($checklist_item_id, ['active' => (int) $checklist_item_chacke]);
         ActionClass::json($_POST);
     }
     if (Yii::app()->getRequest()->getIsPostRequest()) {
         $json = ['success' => false];
         $checklist = Yii::app()->getRequest()->getParam('checklist');
         $checklist_item = Yii::app()->getRequest()->getParam('checklist_item');
         //Create checklist
         if ($checklist && !empty($checklist)) {
             $checklistModel->name = $checklist;
             if ($checklistModel->save()) {
                 return $this->redirect('checklist?list=' . $checklistModel->id);
             }
         }
         //Create checklist item
         if ($checklist_item && !empty($checklist_item)) {
             if ($checklist_id) {
                 $checklistItemModel->name = $checklist_item;
                 $checklistItemModel->checklist_id = $checklist_id;
                 if ($checklistItemModel->save()) {
                     return $this->redirect($_SERVER['HTTP_REFERER']);
                 }
             }
         }
         return $this->redirect($_SERVER['HTTP_REFERER']);
     }
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/request-checklist.css");
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/request-checklist-resp.css");
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/request-checklist.js", CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/checklist.js", CClientScript::POS_END);
     $checklist = $checklistModel->findByPk(Yii::app()->getRequest()->getParam('list'));
     $this->render('checklist', ['model' => $this->_model, 'checklist' => $checklist, 'modelArray' => $modelArray]);
 }
 /**
  * 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 Checklist the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Checklist::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #9
0
//Imports
require_once 'includes/session.php';
require_once 'includes/db.php';
require_once 'includes/Checklist.php';
require_once 'includes/ChecklistItem.php';
if ($_SESSION['USER_GRP'] !== 2) {
    header('Location: ./');
    exit;
}
if (!isset($_GET['_']) || !is_numeric($_GET['_'])) {
    header('Location: ./');
    exit;
}
$con = connect_db();
$list = new Checklist();
$list->id = intval($_GET['_']);
$list->userid = intval($_SESSION['USER_ID']);
$list->date = date('Y-m-d');
$list->get($con);
if ($list->name == '') {
    header('Location: ./');
    exit;
}
$con->close();
?>

<!DOCTYPE html>
<html>
<head>
	<title>Vehicle Checklist</title>
Example #10
0
 public function gridLocalidadesChecklist($data, $row)
 {
     $cantidad = Checklist::model()->findAllByAttributes(array('localidad_id' => $data->id));
     return count($cantidad);
 }
Example #11
0
    ?>
/img/icons/logoPhoto.png">
                        </div>
                    </div>
                </div>
            </div>
            <?php 
}
?>
    </div>
</div>
<div class=" col-md-12 user-cont no-padd">
  
    <?php 
$incapsulEventType = isset($model) && $model->private ? 'Private' : 'Public';
$this->widget('zii.widgets.CMenu', array('items' => array(array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'date' ? 'active' : ''), 'data-url' => 'date'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/date.png" /></span>' . $date), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'map' ? 'active' : ''), 'data-url' => 'map'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/map.png" /></span>' . $map), array('itemOptions' => array('class' => 'user-cont-options col-md-12 checklits' . ($currentPage == 'checklist' ? 'active' : ''), 'data-url' => 'event'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/event.png" /></span>' . $event . '<span class="privorpub">' . $incapsulEventType . '</span>'), array('itemOptions' => array('class' => 'user-cont-options col-md-12 checklits ' . ($currentPage == 'service' ? 'active' : ''), 'data-url' => 'service'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/service.png" /></span>' . $title, 'items' => Services::getAllAsMenu($this->servicesArray)), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'payment' ? 'active' : ''), 'data-url' => 'payment'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/payment.png" /></span>' . $payment), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'booking' ? 'active' : ''), 'data-url' => 'booking'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/booking.png" /></span>' . $booking), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'notes' ? 'active' : ''), 'data-url' => 'notes'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/notes.png" /></span>' . $notes), array('itemOptions' => array('class' => 'user-cont-options col-md-12 checklits ' . ($currentPage == 'checklist' ? 'active' : ''), 'data-url' => 'checklist'), 'label' => '<span class="iconSpan"><i class="fa fa-list-ul"></i></span>' . $checklist, 'items' => Checklist::getAllAsMenu()), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'team' ? 'active' : ''), 'data-url' => 'team'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/team.png" /></span>' . $team), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'timeline' ? 'active' : ''), 'data-url' => 'timeline'), 'label' => '<span class="iconSpan"><img src="' . Yii::app()->theme->baseUrl . '/img/icons/sidebar/timeline.png" /></span>' . $timeLine), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'review' ? 'active' : ''), 'data-url' => 'review'), 'label' => '<span class="iconSpan"><i class="fa fa-star"></i></span>' . $review), array('itemOptions' => array('class' => 'user-cont-options col-md-12 ' . ($currentPage == 'referance' ? 'active' : ''), 'data-url' => 'referance'), 'label' => '<span class="iconSpan"><i class="fa fa-bookmark-o"></i></span>' . $reference)), 'htmlOptions' => array('class' => 'request_nav clearfix'), 'submenuHtmlOptions' => array('class' => 'checklist-sub quote-option'), 'encodeLabel' => false, 'activeCssClass' => 'active', 'itemTemplate' => '<span class="added"></span>{menu}'));
?>
</div>
<?php 
// put your Twilio API credentials here
$accountSid = 'ACc428f1701f51ab5b67c3ec1e119418dd';
$authToken = 'd1cdc9fbf87449ec8eff22b58b35e681';
$version = date('Y-m-d');
// put your Twilio Application Sid here
$appSid = 'AP05d6d7d93d9745349258149dd62937d4';
$clientname = $creatorFirstName;
// put your default Twilio Client name here
$capability = new Services_Twilio_Capability($accountSid, $authToken);
$capability->allowClientOutgoing($appSid);
$capability->allowClientIncoming($clientname);
$token = $capability->generateToken();
Example #12
0
<?php

//Imports
require_once 'db.php';
require_once 'Checklist.php';
require_once 'ChecklistItem.php';
if (empty($_POST['name'])) {
    header("Location: ../addchecklist?e=name");
    exit;
}
$name = $_POST['name'];
$descs = explode('|^|', $_POST['itemdescs']);
$con = connect_db();
$list = new Checklist();
$list->name = $_POST['name'];
$list->save($con);
if ($descs[0] != '') {
    foreach ($descs as $desc) {
        $listItem = new ChecklistItem();
        $listItem->listid = $list->id;
        $listItem->desc = $desc;
        $listItem->save($con);
    }
}
$con->close();
header('Location: ../checklist?_=' . $list->id);