Esempio n. 1
0
 public function __construct()
 {
     parent::__construct();
     $this->setup_name(TRUE, 'materiel', 'materiel');
     $this->entry_attr(array('code' => 'materiel_cod', 'libelle' => 'materiel_designation', 'lv' => 'materiel_lv', 'lj' => 'materiel_lj', 'prix' => 'materiel_cout', 'assign' => 'materiel_assign', 'qte' => 'materiel_qte'));
     // Check the main context (complexe, etablissement and annee)
     check_context();
     // Load needed model
     $this->load->model('local_model');
     // Process changing local
     if ($this->input->post('changer_local')) {
         $this->load->model('local_model');
         $local = $this->local_model->get($this->input->post('materiel_local'));
         if ($local) {
             context_set('local_id', $local->id);
             context_set('local_code', $local->code);
         }
     }
     // Check if local is valid
     $local = NULL;
     if (context_get('local_id') && context_get('local_code')) {
         $local = $this->local_model->get(context_get('local_id'));
     }
     if (!$local) {
         $local = $this->local_model->get_first();
         if ($local) {
             context_set('local_id', $local->id);
             context_set('local_code', $local->code);
         }
     }
     if (!$local) {
         context_set('local_id', NULL);
         context_set('local_code', NULL);
     }
 }
Esempio n. 2
0
 public function contexte_filiere()
 {
     $redirect_to = $this->input->get('redirect');
     check_context_secteur('admin/utilisateur/contexte_filiere' . ($redirect_to ? '?redirect=' . $redirect_to : ''));
     $this->load->helper('form');
     $this->load->helper('common');
     $this->load->model('filiere_model');
     $curr_secteur = context_get('secteur_id');
     $curr_etab_secteur = context_get('etab_secteur_id');
     if ($this->input->post('filiere')) {
         $filiere = $this->filiere_model->get($this->input->post('filiere'));
         $assignment = $filiere ? $this->filiere_model->assignment($filiere->id) : null;
         if ($assignment) {
             context_set('filiere_id', $filiere->id);
             context_set('filiere_libelle', $filiere->libelle);
             context_set('e_s_filiere_id', $assignment->id);
             $this->session->keep_flashdata('flash_msg');
             $this->session->set_flashdata('flash_msg', "Filière sélectionnée");
             redirect($this->input->post('redirect_route') ? $this->input->post('redirect_route') : 'admin');
         } else {
             $this->session->set_flashdata('flash_msg_fail', "Erreur lors de la sélection de filière");
         }
     }
     $data = array('filieres' => $this->filiere_model->list_context(), 'curr_filiere_id' => context_get('filiere_id'), 'redirect_route' => $redirect_to);
     $this->show('utilisateur/contexte_filiere', $data);
 }
Esempio n. 3
0
/**
 * Preprocessor for theme('block').
 */
function jake_preprocess_block(&$vars)
{
    if ($vars['block']->region === 'palette') {
        if (!empty($vars['title'])) {
            $toggler = l($vars['title'], $_GET['q'], array('fragment' => "{$vars['block']->module}-{$vars['block']->delta}", 'attributes' => array('class' => 'palette-link', 'title' => $vars['block']->subject)));
            $vars['pre_object'] = "<div class='widget widget-toggle widget-{$vars['block']->module}-{$vars['block']->delta}'>{$toggler}</div>";
            $vars['attr']['class'] .= ' block-toggle';
        } else {
            $vars['attr']['class'] .= ' widget';
        }
    }
    $classgroups = array('utility-block' => array('mn_search-status', 'data_node-data_table_feedapi_feed', 'stored_views-save'));
    $bid = "{$vars['block']->module}-{$vars['block']->delta}";
    if ($bid == 'stored_views-save') {
        context_set('theme', 'stackclass', 'search');
    }
    foreach ($classgroups as $class => $blocks) {
        if (in_array($bid, $blocks)) {
            $vars['attr']['class'] .= " {$class}";
        }
    }
}
Esempio n. 4
0
/**
 * Preprocessor for theme_comment().
 */
function ginkgo_preprocess_comment(&$vars) {
  // Add a time decay class.
  $decay = _ginkgo_get_comment_decay($vars['node']->nid, $vars['comment']->timestamp);
  $vars['attr']['class'] .= " decay-{$decay['decay']}";

  // If subject field not enabled, replace the title with a number.
  if (!variable_get("comment_subject_field_{$vars['node']->type}", 1)) {
    $vars['title'] = l("#{$decay['order']}", "node/{$vars['node']->nid}", array('fragment' => "comment-{$vars['comment']->cid}"));
  }

  // We're totally previewing a comment... set a context so others can bail.
  if (module_exists('context')) {
    if (empty($vars['comment']->cid) && !empty($vars['comment']->form_id)) {
      context_set('comment', 'preview', TRUE);
    }
    else if (context_isset('comment', 'preview')) {
      $vars = array();
    }
  }
}
Esempio n. 5
0
/**
 * Preprocessor for theme_user_profile_form().
 */
function ginkgo_preprocess_user_profile_form(&$vars)
{
    context_set('theme', 'layout', 'custom');
    context_set('theme', 'body_classes', 'one-sidebar');
}