When status = 0 career/promotion label is in gray, showing only elements with status = 1 in career_dashboard

skala
Julio Montoya 14 years ago
parent dbddca0dfd
commit 2ae18fd886
  1. 5
      main/admin/career_dashboard.php
  2. 10
      main/admin/careers.php
  3. 4
      main/admin/promotions.php
  4. 20
      main/inc/ajax/model.ajax.php
  5. 4
      main/inc/lib/career.lib.php

@ -38,7 +38,7 @@ echo '</div>';
$career = new Career(); $career = new Career();
$careers = $career->get_all(); $careers = $career->get_all(array('status = ?'=>1)); //only status =1
$column_count = 3; $column_count = 3;
$i = 0; $i = 0;
$grid_js = ''; $grid_js = '';
@ -52,6 +52,9 @@ if (!empty($careers)) {
$promotion_array = array(); $promotion_array = array();
if (!empty($promotions)) { if (!empty($promotions)) {
foreach($promotions as $promotion_item) { foreach($promotions as $promotion_item) {
if (!$promotion_item['status']) {
continue; //avoid status = 0
}
//Getting all sessions from this promotion //Getting all sessions from this promotion
$sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']); $sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']);

@ -49,8 +49,8 @@ $columns = array(get_lang('Name'), get_lang('Description'), get_lang('Act
//Column config //Column config
$column_model = array( $column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'), array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'),
array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left'), array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left','sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter') array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false')
); );
//Autowidth //Autowidth
$extra_params['autowidth'] = 'true'; $extra_params['autowidth'] = 'true';
@ -119,11 +119,11 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
if ($check) { if ($check) {
$values = $form->exportValues(); $values = $form->exportValues();
$career->update_all_promotion_status_by_career_id($values['id'],$values['status']); $career->update_all_promotion_status_by_career_id($values['id'],$values['status']);
$res = $career->update($values); $res = $career->update($values);
if ($values['status']) { if ($values['status']) {
Display::display_confirmation_message(sprintf(get_lang('CareerXArchived'), $values['name']), false); Display::display_confirmation_message(sprintf(get_lang('CareerXUnarchived'), $values['name']), false);
} else { } else {
Display::display_confirmation_message(sprintf(get_lang('CareerXUnarchived'), $values['name']), false); Display::display_confirmation_message(sprintf(get_lang('CareerXArchived'), $values['name']), false);
} }
} }
Security::clear_token(); Security::clear_token();

@ -55,8 +55,8 @@ $columns = array(get_lang('Name'),get_lang('Career'),get_lang('Descriptio
$column_model = array( $column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'), array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'),
array('name'=>'career', 'index'=>'career', 'width'=>'100', 'align'=>'left'), array('name'=>'career', 'index'=>'career', 'width'=>'100', 'align'=>'left'),
array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left'), array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left','sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter'), array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false'),
); );
$extra_params['autowidth'] = 'true'; //use the width of the parent $extra_params['autowidth'] = 'true'; //use the width of the parent
//$extra_params['editurl'] = $url; //use the width of the parent //$extra_params['editurl'] = $url; //use the width of the parent

@ -76,13 +76,31 @@ switch ($action) {
$sidx = 'name'; $sidx = 'name';
} }
$result = Database::select('*', $obj->table, array('order'=>"$sidx $sord", 'LIMIT'=> "$start , $limit")); $result = Database::select('*', $obj->table, array('order'=>"$sidx $sord", 'LIMIT'=> "$start , $limit"));
$new_result = array();
foreach($result as $item) {
if (!$item['status']) {
$item['name'] = '<font style="color:#AAA">'.$item['name'].'</font>';
}
$new_result[] = $item;
}
$result = $new_result;
break; break;
case 'get_promotions': case 'get_promotions':
$columns = array('name', 'career', 'description', 'actions'); $columns = array('name', 'career', 'description', 'actions');
if(!in_array($sidx, $columns)) { if(!in_array($sidx, $columns)) {
$sidx = 'name'; $sidx = 'name';
} }
$result = Database::select('p.id,p.name, p.description, c.name as career', "$obj->table p LEFT JOIN ".Database::get_main_table(TABLE_CAREER)." c ON c.id = p.career_id ", array('order' =>"$sidx $sord", 'LIMIT'=> "$start , $limit")); $result = Database::select('p.id,p.name, p.description, c.name as career, p.status', "$obj->table p LEFT JOIN ".Database::get_main_table(TABLE_CAREER)." c ON c.id = p.career_id ", array('order' =>"$sidx $sord", 'LIMIT'=> "$start , $limit"));
$new_result = array();
foreach($result as $item) {
if (!$item['status']) {
$item['name'] = '<font style="color:#AAA">'.$item['name'].'</font>';
}
$new_result[] = $item;
}
$result = $new_result;
break; break;
case 'get_usergroups': case 'get_usergroups':
$columns = array('name', 'users', 'courses','sessions','actions'); $columns = array('name', 'users', 'courses','sessions','actions');

@ -24,8 +24,8 @@ class Career extends Model {
$this->table = Database::get_main_table(TABLE_CAREER); $this->table = Database::get_main_table(TABLE_CAREER);
} }
public function get_all() { public function get_all($where_conditions = array()) {
return Database::select('*',$this->table, array('order' =>'name ASC')); return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'name ASC'));
} }
/** /**

Loading…
Cancel
Save