示例#1
0
 public function getCurrentSemester()
 {
     $this->db->select('semester.*');
     $this->db->from('semester');
     $this->db->join('current_semester', 'current_semester.id_semester = semester.id_semester');
     $currentSemester = $this->db->get()->row_array();
     $currentSemester = checkArray($currentSemester);
     return $currentSemester;
 }
示例#2
0
 /**
  * Search on database for the permissions of a group
  * @param $groupId - The group id to get the permissions
  * @return an array with the permissions of the given group
  */
 public function getGroupPermissions($groupId)
 {
     $this->db->select('permission.permission_name, permission.route');
     $this->db->from("permission");
     $this->db->join("group_permission", "permission.id_permission = group_permission.id_permission");
     $this->db->where("group_permission.id_group", $groupId);
     $groupPermissions = $this->db->get()->result_array();
     $groupPermissions = checkArray($groupPermissions);
     return $groupPermissions;
 }
示例#3
0
function checkArray($val, $arr)
{
    if (in_array($val, $arr)) {
        return true;
    }
    foreach ($arr as $k) {
        if (is_array($k) && checkArray($val, $k)) {
            return true;
        }
    }
    return false;
}
示例#4
0
function getCurrentYear()
{
    $ci = get_instance();
    $getYearSql = "SELECT YEAR(CURDATE())";
    $currentYear = $ci->db->query($getYearSql)->row_array();
    $currentYear = checkArray($currentYear);
    if ($currentYear !== FALSE) {
        $currentYear = $currentYear['YEAR(CURDATE())'];
    } else {
        $currentYear = FALSE;
    }
    return $currentYear;
}
 public function sendData($package_data)
 {
     $output = array();
     foreach ($package_data as $package) {
         $user = checkArray($package, 'user') ? $package['user'] : false;
         $repo = checkArray($package, 'repo') ? $package['repo'] : false;
         $description = checkArray($package, 'description') ? $package['description'] : false;
         if ($user && $repo && $description) {
             $output[$user . ':' . $repo] = array('user' => $user, 'repo' => $repo, 'description' => $description);
         }
     }
     return json_encode($output);
 }
示例#6
0
function checkArray($array)
{
    foreach ($array as $value) {
        if (is_array($value)) {
            if (count($value)) {
                if (!checkArray($value)) {
                    return false;
                }
            }
        } else {
            $value = trim($value);
            if (!empty($value)) {
                return false;
            }
        }
        $i++;
    }
    return true;
}
示例#7
0
 public function getExpenseType($value)
 {
     $objectToReturn = $this->db->get_where("expense_type", array('id' => $value))->row_array();
     $objectToReturn = checkArray($objectToReturn);
     return $objectToReturn;
 }
示例#8
0
 private function row($type, $param_name = '', $param_value = '', $param_type = '')
 {
     $text = $type == 'text' ? true : false;
     $textarea = $type == 'textarea' ? true : false;
     $checkbox = $type == 'checkbox' ? true : false;
     $file = $type == 'file' ? true : false;
     $submit = $type == 'submit' ? true : false;
     $hidden = $type == 'hidden' ? true : false;
     $select = $type == 'select' ? true : false;
     $datepicker = $type == 'datepicker' ? true : false;
     if (!$hidden) {
         $this->values_count++;
     }
     if ($file) {
         $this->upload_count++;
     }
     $html = "";
     if ($text || $textarea || $checkbox || $file || $submit || $select || $datepicker) {
         if ($param_name == 'state') {
             $html .= "<div class='" . $this->form_label_class . "' id='store_state_name'>";
         } elseif ($param_name == 'fun_category_id') {
             $html .= "<div class='" . $this->form_label_class . "' id='fun_admin' style='display:none'>";
         } elseif ($param_name == 'city') {
             $html .= "<div class='" . $this->form_label_class . "' id='store_city_name'>";
         } elseif ($param_name == 'categoryid' && $param_value == '') {
             $html .= "<div class='" . $this->form_label_class . "' id='categoryid' style='display: none'>";
             //} elseif($param_name == 'latitude' || $param_name == 'longitude') {
             //		$html .= "<div class='" . $this->form_label_class . " store_latlng'  style='display: none'>";
         } else {
             $html .= "<div class='" . $this->form_label_class . "'>";
         }
     }
     if ($text || $textarea || $checkbox || $file || $submit || $select || $datepicker) {
         $html .= "<div class='generatrix-control-form-label-internal'>";
     }
     if ($text || $textarea || $checkbox || $file || $select || $datepicker) {
         $html .= $this->processName($param_name);
     }
     if ($submit) {
         $html .= "&nbsp;";
     }
     if ($text || $textarea || $checkbox || $file || $submit || $select || $datepicker) {
         $html .= "</div>";
     }
     if ($text || $textarea || $checkbox || $file || $submit || $select || $datepicker) {
         $html .= "</div>";
     }
     if ($text || $textarea || $checkbox || $file || $submit || $select || $datepicker) {
         $html .= "<div class='" . $this->form_value_class . "'>";
     }
     $textarea_size = '50px';
     if ($textarea) {
         if ($param_type != '') {
             $size = str_replace('varchar_', '', $param_type);
             if ($size > 256 && $size < 512) {
                 $textarea_size = '80px';
             } else {
                 if ($size > 512) {
                     $textarea_size = '200px';
                 }
             }
         }
     }
     if ($text) {
         if (!$param_value && ($param_name == 'categorytype' || $param_name == 'categoryname' || $param_name == 'fun_category_id')) {
             $selected = isset($_POST['selectcat']) ? $_POST['selectcat'] : '';
             $split = explode('$##$', $selected);
             $category_type = checkArray($split, 0) ? $split[0] : '';
             $category_name = checkArray($split, 1) ? $split[1] : '';
             $category_id = checkArray($split, 2) ? $split[2] : '';
             if ($param_name == 'categorytype') {
                 $html .= "<input type='text' class='generatrix-control-form-element-text'  name='" . $param_name . "' value='" . $category_type . "' readonly />";
             }
             if ($param_name == 'categoryname') {
                 $html .= "<input type='text' class='generatrix-control-form-element-text'  name='" . $param_name . "' value='" . $category_name . "' readonly />";
             }
             if ($param_name == 'fun_category_id') {
                 $html .= "<input type='hidden' class='generatrix-control-form-element-text'  name='" . $param_name . "' value='" . $category_id . "' />";
             }
         } elseif ($param_value && ($param_name == 'categorytype' || $param_name == 'categoryname' || $param_name == 'fun_category_id')) {
             if ($param_name == 'categorytype') {
                 $html .= "<input type='text' class='generatrix-control-form-element-text'  name='" . $param_name . "' value='" . $param_value . "' readonly />";
             }
             if ($param_name == 'categoryname') {
                 $html .= "<input type='text' class='generatrix-control-form-element-text'  name='" . $param_name . "' value='" . $param_value . "' readonly />";
             }
         } elseif ($param_name == 'width' || $param_name == 'height') {
             $html .= "<input type='text' maxlength='3' size='3' style='width: auto;' class='generatrix-control-form-element-text' name='" . $param_name . "' value='" . $param_value . "' />";
         } elseif ($param_name == 'country') {
             $html .= "<input type='text' class='generatrix-control-form-element-text' id='store_country'  name='" . $param_name . "' value='" . $param_value . "' />";
         } elseif ($param_name == 'state') {
             $html .= "<input type='text' class='generatrix-control-form-element-text' id='store_state'  name='" . $param_name . "' value='" . $param_value . "' />";
         } elseif ($param_name == 'city') {
             $html .= "<input type='text' class='generatrix-control-form-element-text' id='store_city'  name='" . $param_name . "' value='" . $param_value . "' />";
         } elseif ($param_name == 'categoryid' && $param_value == '') {
             $category_id = isset($_POST['selectcat']) ? $_POST['selectcat'] : '';
             $html .= "<input type='hidden' class='generatrix-control-form-element-text' name='" . $param_name . "' value='" . $category_id . "' />";
             //} elseif($param_name == 'latitude' || $param_name == 'longitude') {
             //		$html .= "<input type='hidden' class='generatrix-control-form-element-text' name='" . $param_name . "' value='" . $param_value . "' />";
         } elseif ($param_name == 'fun_category_id') {
             $html .= "<input type='hidden' class='generatrix-control-form-element-text'  name='" . $param_name . "' value='" . $category_id . "' />";
         } else {
             $html .= "<input type='text' class='generatrix-control-form-element-text' name='" . $param_name . "' value='" . str_replace("'", "&#039;", $param_value) . "' />";
         }
     }
     if ($textarea) {
         if ($param_name == 'address') {
             $html .= "<textarea class='generatrix-control-form-element-textarea' style='height: " . $textarea_size . "' name='" . $param_name . "'>" . $param_value . "</textarea><span id='span_store_address'><img src='" . href('/public/style/../images/loading.gif') . "'>&nbsp;&nbsp;Checking address..</span>";
         } else {
             $html .= "<textarea class='generatrix-control-form-element-textarea' style='height: " . $textarea_size . "' name='" . $param_name . "'>" . $param_value . "</textarea>";
         }
     }
     if ($checkbox) {
         $checked = $param_value == 'off' ? '' : 'checked="CHECKED"';
         $html .= "<input type='checkbox' class='generatrix-control-form-element-checkbox' name='" . $param_name . "' " . $checked . " />";
     }
     if ($file) {
         $html .= "<input type='file' class='generatrix-control-form-element-file' name='" . $param_name . "' />";
         if ($param_value != '') {
             $dots = explode('.', $param_value);
             $extension = strtolower($dots[count($dots) - 1]);
             $images = array('png', 'jpg', 'tiff', 'gif');
             if (in_array($extension, $images)) {
                 if (file_exists(path($param_value))) {
                     $html .= '<a target="_blank" href="' . href($param_value) . '" class="generatrix-control-table-link"><img src="' . image($param_value) . '" /></a>';
                 } else {
                     $html .= 'File Missing';
                 }
             } else {
                 $slashes = explode('/', $param_value);
                 $file_name = $slashes[count($slashes) - 1];
                 $file_name = substr($file_name, 7, strlen($file_name) - 1);
                 $html .= '<a target="_blank" href="' . href($param_value) . '">' . $file_name . '</a>';
             }
         }
     }
     if ($datepicker) {
         $date = check($param_value) ? $param_value : date('m/d/y');
         $html .= "<input type='text' name='" . $param_name . "'  value='" . $date . "' class='generatrix-control-form-element-date' id='insert_date' /></div>";
     }
     if ($submit) {
         $message = $this->upload_count / $this->values_count > 0.2 ? 'Upload' : 'Save';
         if ($this->table == 'stores') {
             $html .= "<input type='submit' id='stores_submit' name='submit' value='" . $message . "' class='generatrix-control-form-element-submit' /> or <a href='" . href('/admin/dashboard/' . $this->table . '/view/1') . "'>Cancel</a>";
         } else {
             $html .= "<input type='submit' name='submit' value='" . $message . "' class='generatrix-control-form-element-submit' /> or <a href='" . href('/admin/dashboard/' . $this->table . '/view/1') . "'>Cancel</a>";
         }
     }
     if ($select) {
         $temp_html = '<option value="0">Please select a value</option>';
         foreach ($this->select[$param_name] as $key => $value) {
             $selected = $param_value == $value ? 'SELECTED' : '';
             $temp_html .= '<option value="' . $value . '" ' . $selected . '>' . $key . '</option>';
         }
         $html .= '<select name="' . $param_name . '">' . $temp_html . '</select>';
     }
     if ($text || $textarea || $checkbox || $file || $submit || $select) {
         $html .= "</div>";
     }
     $html .= '<br clear="all" />';
     if ($hidden) {
         $html = '<input type="hidden" name="' . $param_name . '" value="' . $param_value . '" />';
     }
     return $html;
 }
示例#9
0
 private function rowFile($label, $value, $subtext, $required)
 {
     $html = '';
     $html .= '<div class="row">';
     $html .= '	<div class="label-' . $this->size . '" ' . $this->noFloat() . '>';
     $html .= '		' . $label;
     if ($required) {
         $html .= ' *';
     }
     $html .= '	</div>';
     $html .= '	<div class="element-' . $this->size . '" ' . $this->noFloat() . '>';
     $html .= '		<div>';
     $html .= '			<input type="file" id="' . sanitize($label) . '" name="' . sanitize($label) . '" value="" class="form-input-text input-' . $this->size . '" />';
     if ($value != '') {
         $actual_value = checkArray($this->terms, $value) ? $this->terms[$value] : $value;
         $html .= '		<br />' . urldecode($actual_value);
     }
     $html .= '		</div>';
     $html .= '		<div class="form-input-subtext">';
     $html .= '			' . $subtext;
     $html .= '		</div>';
     $html .= '	</div>';
     if ($this->float != 'none') {
         $html .= '	<br clear="all" />';
     }
     $html .= '</div>';
     echo $html;
 }
示例#10
0
 public function get($attr, $value)
 {
     $object = $this->db->get_where("budgetplan", array($attr => $value))->row_array();
     $object = checkArray($object);
     return $object;
 }
示例#11
0
 public function getGetValue($tag_name)
 {
     return checkArray($_GET, $tag_name) ? mysql_real_escape_string($_GET[$tag_name], $this->getDb()->getConnection()) : false;
 }
示例#12
0
            <?php 
$i = 0;
foreach ($menuname_arr as $valmenu) {
    ?>
            	<div style="padding-top:5px; margin-bottom:10px;"> 
            	<h5 class="heading" style="margin-bottom:5px; color:#06C;"><?php 
    echo $lang_menu[$valmenu];
    ?>
</h5>  
				<div class="columns">    				
					<?php 
    $sql_thismenu = "SELECT * FROM menulist WHERE SUBSTR(menuName,1, INSTR(menuName,'.')-1) = '" . $valmenu . "'";
    $rs_thismenu = mysql_query($sql_thismenu);
    while ($data_thismenu = @mysql_fetch_object($rs_thismenu)) {
        //echo $data_thismenu->menuName;
        if (checkArray($data_thismenu->menuName, $menuname_subarr)) {
            $data_menuid = select_db('menulist', 'where menuName = "' . $data_thismenu->menuName . '"');
            #echo $data_menuid[0]['menuId'];
            $i++;
            ?>
    
							<div>  	
							<label class="uni-checkbox">
								<input type="checkbox" id="check_edit<?php 
            echo $i;
            ?>
" name="check_edit<?php 
            echo $i;
            ?>
" value="<?php 
            echo $data_menuid[0]['menuId'];
示例#13
0
 private function checkExistingMessage($mastermindId, $requestId)
 {
     $messageData = array('id_mastermind' => $mastermindId, 'id_request' => $requestId);
     $existingMessage = $this->db->get_where('mastermind_message', $messageData)->row_array();
     $existingMessage = checkArray($existingMessage);
     if ($existingMessage !== FALSE) {
         if ($existingMessage['message'] !== NULL) {
             $thereIsMessage = TRUE;
         } else {
             $thereIsMessage = FALSE;
         }
     } else {
         $thereIsMessage = FALSE;
     }
     return $thereIsMessage;
 }
示例#14
0
 public function getOfferSemester($offerId)
 {
     $offerExists = $this->checkIfOfferExists($offerId);
     if ($offerExists) {
         $searchResult = $this->db->get_where('semester', array('offer' => $offerId));
         $foundOfferSemester = $searchResult->row_array();
         $foundOfferSemester = checkArray($foundOfferSemester);
     } else {
         $foundOfferSemester = FALSE;
     }
     return $foundOfferSemester;
 }
示例#15
0
 private function getProgramEvaluation($evaluationData)
 {
     $foundEvaluation = $this->db->get_where('program_evaluation', $evaluationData)->row_array();
     $foundEvaluation = checkArray($foundEvaluation);
     return $foundEvaluation;
 }
示例#16
0
/**
 getCommonBusesForNormalizedStopName: function returns the common buses that go to the junction from the start or end point. We will be 
TODO: CHekc the functionality again
**/
function getCommonBusesForNormalizedStopName($stopName, $arrBusesForIntersection)
{
    $arrJunctionBuses = array();
    /*if(strcmp($stopName,"Central Silk Board (ORR)")==0)
    	{
    
    		$busQuery="SELECT DISTINCT BusNumber FROM  BusDetails WHERE (StopName='Central Silk Board (ORR)') OR (StopName = 'Central Silk Board (Hosur RD)') OR (StopName = 'Central Silk Board (BTM)') ORDER BY BusNumber";
    		$busResult= mysql_query($busQuery);
    		$busRowsnum = mysql_num_rows($busResult);
    		
    		for($j=0;$j<$busRowsnum;$j++)
    		{
    			$busRow=mysql_fetch_row($busResult);
    			array_push($arrJunctionBuses,$busRow[0]);
    		}	
    		
    
    	}
    	else if(strcmp($stopName,"Marathahalli Bridge")==0)
    	{
    		$busQuery="SELECT DISTINCT BusNumber FROM  BusDetails WHERE (StopName='Marathahalli (Jn. Vartur & ORR)') OR (StopName = 'Marathahalli Bridge (ORR)') OR (StopName = 'Marathahalli Bridge') OR (StopName='Marathahalli Multiplex Bridge') OR (StopName='Marathahalli Jn') ORDER BY BusNumber";
    		$busResult= mysql_query($busQuery);
    		$busRowsnum = mysql_num_rows($busResult);
    		
    		for($j=0;$j<$busRowsnum;$j++)
    		{
    			$busRow=mysql_fetch_row($busResult);
    			array_push($arrJunctionBuses,$busRow[0]);
    		}	
    		
    	}
    	else if(strcmp($stopName,"Marathahalli Multiplex")==0)
    	{
    		$busQuery="SELECT DISTINCT BusNumber FROM  BusDetails WHERE (StopName='Marathahalli Jn(Multiplex)') OR (StopName = 'Marathahalli (Mulitplex ORR)') OR (StopName = 'Marathahalli Multiplex') ORDER BY BusNumber";
    		$busResult= mysql_query($busQuery);
    		$busRowsnum = mysql_num_rows($busResult);
    		
    		for($j=0;$j<$busRowsnum;$j++)
    		{
    			$busRow=mysql_fetch_row($busResult);
    			array_push($arrJunctionBuses,$busRow[0]);
    		}
    
    	}
    	else if(strcmp($stopName,"Hebbala")==0)
    	{
    		$busQuery="SELECT DISTINCT BusNumber FROM  BusDetails WHERE (StopName='Hebbala') OR (StopName = 'Hebbala (ORR)') OR (StopName = 'Hebbala (Canara Bank)') ORDER BY BusNumber";
    		$busResult= mysql_query($busQuery);
    		$busRowsnum = mysql_num_rows($busResult);
    		
    		for($j=0;$j<$busRowsnum;$j++)
    		{
    			$busRow=mysql_fetch_row($busResult);
    			array_push($arrJunctionBuses,$busRow[0]);
    		}
    	
    	}
    
    	else
    	{
    		//echo "STOP".$stopName;
    		$arrJunctionBuses=getArrayBusesForStop($stopName);
    	}*/
    $arrJunctionBuses = getArrayBusesForStop($stopName);
    //	print_r($arrBusesForIntersection);
    //	echo "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$";
    //	print_r($arrJunctionBuses);
    $arrCommon = array();
    //$arrCommon=array_intersect($arrJunctionBuses,$arrBusesForIntersection);
    //find the common values
    for ($i = 0; $i < sizeof($arrBusesForIntersection); $i++) {
        $temp = $arrBusesForIntersection[$i];
        for ($j = 0; $j < sizeof($arrJunctionBuses); $j++) {
            if (strcmp($temp, $arrJunctionBuses[$j]) == 0) {
                if (checkArray($arrCommon, $temp) == 0) {
                    array_push($arrCommon, $temp);
                }
            }
        }
    }
    //print_r($arrCommon);
    $buses = "";
    for ($i = 0; $i < sizeof($arrCommon); $i++) {
        $buses = $buses . $arrCommon[$i] . ",";
    }
    //return getBusesForStop($stopName);
    return $buses;
}
示例#17
0
 /**
  * Merging Entire request variables into one
  * complete array
  */
 private static function checkRequestParams()
 {
     /*
      * Appending url keyword to query string
      * i.e twitter.php?retweet={retweet}&count={count}
      */
     $url = 'url=' . $_SERVER['QUERY_STRING'];
     /*
      * queryStringToArray function convert query string into array
      * and assign it to $this->requestParams
      */
     self::$requestParams = queryStringToArray($url);
     /* Merge self::$data and $this->requestParams to get single array */
     self::$requestParams = array_merge(self::$requestParams, self::$data);
     /* checkArray function check for null values and handle sql Injection */
     $flag = checkArray(self::$requestParams);
     if ($flag['status'] == 'fail') {
         ErrorAndMessages::generalError("Invalid value for {$flag['key']}", 400);
     }
 }
示例#18
0
 public function add($list)
 {
     $this->addLibraries();
     $head = $this->getHead();
     $files = (array) json_decode($list, true);
     if (checkArray($files, 'css')) {
         foreach ($files['css'] as $file) {
             $head->appendContent($this->addCss($file));
         }
     }
     if (checkArray($files, 'js')) {
         foreach ($files['js'] as $file) {
             $head->appendContent($this->addJavascript($file));
         }
     }
     $this->setHead($head);
 }
示例#19
0
 private function getArea($areaToSearch)
 {
     $this->db->select('area_name');
     $foundArea = $this->db->get_where('program_area', $areaToSearch)->row_array();
     $foundArea = checkArray($foundArea);
     return $foundArea;
 }
示例#20
0
 public function buscaTodos()
 {
     $res = $this->db->get("departamentos")->result_array();
     $res = checkArray($res);
     return $res;
 }
 public function destroy($id, $article_id)
 {
     $article = BlogArticle::find($article_id);
     $comments = BlogArticle::find($article['id'])->comments()->get();
     if (!checkArray($comments)) {
         $comments->delete();
     }
     $article->delete();
     //$comments= BlogArticle::find($article_id)->hasManyComments()->delete();
     //$comments=DB::table('blog_comments')->where('article_id','=',$article_id)->delete();
     return Redirect::to('blog/' . $id . '/admin');
 }
示例#22
0
 public function getTempRequest($tempRequestData)
 {
     $foundRequest = $this->db->get_where('temporary_student_request', $tempRequestData)->row_array();
     $foundRequest = checkArray($foundRequest);
     return $foundRequest;
 }
/**
getCommonBusesForNormalizedStopName: function returns the common buses that go to the junction from the start or end point. We will be
TODO: CHekc the functionality again
 **/
function getCommonBusesForNormalizedStopName($stopName, $arrBusesForIntersection)
{
    $arrJunctionBuses = array();
    $arrJunctionBuses = getArrayBusesForStop($stopName);
    //	print_r($arrBusesForIntersection);
    //	echo "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$";
    //	print_r($arrJunctionBuses);
    $arrCommon = array();
    //$arrCommon=array_intersect($arrJunctionBuses,$arrBusesForIntersection);
    //find the common values
    for ($i = 0; $i < sizeof($arrBusesForIntersection); $i++) {
        $temp = $arrBusesForIntersection[$i];
        for ($j = 0; $j < sizeof($arrJunctionBuses); $j++) {
            if (strcmp($temp, $arrJunctionBuses[$j]) == 0) {
                if (checkArray($arrCommon, $temp) == 0) {
                    array_push($arrCommon, $temp);
                }
            }
        }
    }
    $buses = "";
    for ($i = 0; $i < sizeof($arrCommon); $i++) {
        $buses = $buses . $arrCommon[$i] . ",";
    }
    //return getBusesForStop($stopName);
    return $buses;
}
示例#24
0
<?php

$repos = $this->get('repos');
//display($repos);
$count = 1;
foreach ($repos as $repo) {
    $data = array();
    $fields = array('id', 'name', 'description', 'group', 'created');
    foreach ($fields as $field) {
        $data[$field] = checkArray($repo, $field) ? $repo[$field] : '';
    }
    echo $count . ". ";
    echo "<a href='" . href('/projects/info/' . $data['name']) . "'>" . substr($data['name'], 0, 30) . "</a> ";
    echo "<span style='color: grey; font-size: 9px;'>" . substr($data['description'], 0, 60) . "</span>";
    //echo date("d M Y", $data['created']);
    //echo " (<a href='" . href('/posts/remove/' . $data['id']) . "'>del</a>)";
    echo "<br />";
    $count++;
}
示例#25
0
 public function getClassHourInSchedule($idOfferDiscipline, $hour, $day)
 {
     $this->db->select('discipline_schedule.*');
     $this->db->from('discipline_schedule');
     $this->db->join('class_hour', "discipline_schedule.id_class_hour = class_hour.id_class_hour");
     $this->db->where('discipline_schedule.id_offer_discipline', $idOfferDiscipline);
     $this->db->where('class_hour.hour', $hour);
     $this->db->where('class_hour.day', $day);
     $foundClassHour = $this->db->get()->row_array();
     $foundClassHour = checkArray($foundClassHour);
     return $foundClassHour;
 }
示例#26
0
 /**
  * Get the course type id registered for a given course id
  * @param $id_course - The course id to look for the course type 
  * @return a String with the registered course type for the given course id if found, or FALSE if does not
  */
 private function getCourseTypeForThisCourseId($id_course)
 {
     $this->db->select('course_type_id');
     $searchResult = $this->db->get_where('course', array('id_course' => $id_course));
     $foundCourseType = $searchResult->row_array();
     $foundCourseType = checkArray($foundCourseType);
     if ($foundCourseType !== FALSE) {
         $foundCourseType = $foundCourseType['course_type_id'];
     } else {
         $foundCourseType = FALSE;
     }
     return $foundCourseType;
 }
示例#27
0
 private function getSyllabus($attribute, $value)
 {
     $searchResult = $this->db->get_where('course_syllabus', array($attribute => $value));
     $foundSyllabus = $searchResult->row_array();
     $foundSyllabus = checkArray($foundSyllabus);
     return $foundSyllabus;
 }
示例#28
0
 public function disciplineExists($disciplineCode, $disciplineName)
 {
     $this->db->where('discipline_code', $disciplineCode);
     $disciplineCodeExists = $this->db->get('discipline')->row_array();
     $disciplineCodeExists = checkArray($disciplineCodeExists);
     $this->db->where('discipline_name', $disciplineName);
     $disciplineNameExists = $this->db->get('discipline')->row_array();
     $disciplineNameExists = checkArray($disciplineNameExists);
     if ($disciplineCodeExists && $disciplineNameExists) {
         $existsCode = TRUE;
         $existsName = TRUE;
     } else {
         if ($disciplineNameExists) {
             $existsName = TRUE;
             $existsCode = FALSE;
         } else {
             if ($disciplineCodeExists) {
                 $existsCode = TRUE;
                 $existsName = FALSE;
             } else {
                 $existsCode = FALSE;
                 $existsName = FALSE;
             }
         }
     }
     $exists = array('code' => $existsCode, 'name' => $existsName);
     return $exists;
 }
示例#29
0
 private function getControllerAndMethod()
 {
     // Parse the values obtained from the url (obtained from .htaccess) to get the controller and view
     $details = array();
     if (USE_CATCH_ALL) {
         require_once path('/app/settings/mapping.php');
         $request = array();
         if ($this->cli->isEnabled()) {
             $request = $this->getCliArray();
         } else {
             $request = $this->getRequestArray();
         }
         $details = mapping($request);
         if (!checkArray($details, 'controller')) {
             $details['controller'] = isset($request[0]) && $request[0] != '' ? $request[0] : DEFAULT_CONTROLLER;
         }
         if (!checkArray($details, 'method')) {
             $details['method'] = isset($request[1]) && $request[1] != '' ? $request[1] : 'base';
         }
         // Do not destroy the generatrix controller
         $c_id = $this->cli->isEnabled() ? 1 : 0;
         if (isset($request[$c_id]) && $request[$c_id] == 'generatrix') {
             $details['controller'] = $request[$c_id];
             $c_id++;
             if (isset($request[$c_id]) && $request[$c_id] != '') {
                 $details['method'] = $request[$c_id];
             } else {
                 $details['method'] = 'base';
             }
         }
     } else {
         // If no controller or method is defined, we need to use the DEFAULT_CONTROLLER (defined in app/settings/config.php)
         // If cli is enabled, we use the format site.com/index.php controller function
         // 		Hence we need to get the values from the arguments as $argv[0], $argv[1] etc
         if ($this->cli->isEnabled()) {
             if ($this->cli->getValue('controller') == "") {
                 header('HTTP/1.1 301 Moved Permanently');
                 location('/' . DEFAULT_CONTROLLER);
             }
             $details['controller'] = $this->cli->getValue('controller') == "" ? DEFAULT_CONTROLLER : $this->cli->getValue('controller');
             $details['method'] = $this->cli->getValue('method') == "" ? 'base' : $this->cli->getValue('method');
         } else {
             // If this request is coming from the browser, we need to get the value from url (obtained from .htaccess)
             if ($this->request->getValue('controller') == "") {
                 header('HTTP/1.1 301 Moved Permanently');
                 location('/' . DEFAULT_CONTROLLER);
             }
             $details['controller'] = $this->request->getValue('controller') == "" ? DEFAULT_CONTROLLER : $this->request->getValue('controller');
             $details['method'] = $this->request->getValue('method') == "" ? 'base' : $this->request->getValue('method');
         }
         // TODO : Add customHandlers
         // We need to set the $controller and $method for the generatrix class
         $this->controller = function_exists('customHandlers') ? customHandlers($details, 'controller') : $details['controller'];
         $this->method = function_exists('customHandlers') ? customHandlers($details, 'method') : $details['method'];
         // set the controller and method again (depending on the customHandlers)
         $details['controller'] = $this->controller;
         $details['method'] = $this->method;
     }
     return $details;
 }
示例#30
0
 public function getStudentBasicInformation($idUser)
 {
     $studentBasics = $this->db->get_where('students_basic_information', array('id_user' => $idUser))->row_array();
     $studentBasics = checkArray($studentBasics);
     return $studentBasics;
 }