Example #1
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('email');
     $this->load->library('session');
     $this->load->helper('cookie');
 }
 /**
  * Return json array with Deploy Studio workflow breakdown
  *
  * @author Benedicte Emilie Braekken
  **/
 function workflow()
 {
     $out = array();
     $deploystudio = new Dsw_model();
     $sql = "SELECT count(1) as count, workflow \n\t\t\t\tFROM deploystudio\n\t\t\t\tGROUP BY workflow\n\t\t\t\tORDER BY workflow ASC";
     $workflow_arr = array();
     foreach ($deploystudio->query($sql) as $obj) {
         $obj->workflow = $obj->workflow ? $obj->workflow : 'noworkflow';
         $workflow_arr[$obj->workflow] = $obj->count;
     }
     // Convert to flotr array
     $cnt = 0;
     foreach ($workflow_arr as $workflow => $count) {
         $workflow = $workflow == '0' ? 'Unknown' : $workflow;
         $out[] = array('label' => $workflow, 'data' => array(array(intval($count), $cnt++)));
     }
     $obj = new View();
     $obj->view('json', array('msg' => $out));
 }