$template->put_all(array('C_EDIT_CONTRIBUTION' => true, 'EDITOR' => $editor->display(), 'ENTITLED' => $contribution->get_entitled(), 'DESCRIPTION' => FormatingHelper::unparse($contribution->get_description()), 'CONTRIBUTION_ID' => $contribution->get_id(), 'EVENT_STATUS_UNREAD_SELECTED' => $contribution->get_status() == Event::EVENT_STATUS_UNREAD ? ' selected="selected"' : '', 'EVENT_STATUS_BEING_PROCESSED_SELECTED' => $contribution->get_status() == Event::EVENT_STATUS_BEING_PROCESSED ? ' selected="selected"' : '', 'EVENT_STATUS_PROCESSED_SELECTED' => $contribution->get_status() == Event::EVENT_STATUS_PROCESSED ? ' selected="selected"' : '', 'L_CONTRIBUTION_STATUS_UNREAD' => $LANG['contribution_status_unread'], 'L_CONTRIBUTION_STATUS_BEING_PROCESSED' => $LANG['contribution_status_being_processed'], 'L_CONTRIBUTION_STATUS_PROCESSED' => $LANG['contribution_status_processed'], 'L_CONTRIBUTION' => $LANG['contribution'], 'L_DESCRIPTION' => $LANG['contribution_description'], 'L_STATUS' => $LANG['contribution_status'], 'L_ENTITLED' => $LANG['contribution_entitled'], 'L_SUBMIT' => $LANG['submit'], 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset'])); } else { $template->put_all(array('C_CONTRIBUTION_LIST' => true)); //Nombre de contributions $num_contributions = 1; define('CONTRIBUTIONS_PER_PAGE', 20); $page = AppContext::get_request()->get_getint('p', 1); //Gestion des critères de tri $criteria = retrieve(GET, 'criteria', 'current_status'); $order = retrieve(GET, 'order', 'asc'); if (!in_array($criteria, array('entitled', 'module', 'status', 'creation_date', 'fixing_date', 'poster_id', 'fixer_id'))) { $criteria = 'current_status'; } $order = $order == 'desc' ? 'desc' : 'asc'; //On liste les contributions foreach (ContributionService::get_all_contributions($criteria, $order) as $this_contribution) { //Obligé de faire une variable temp à cause de php4. $creation_date = $this_contribution->get_creation_date(); $fixing_date = $this_contribution->get_fixing_date(); //Affichage des contributions du membre if (AppContext::get_current_user()->check_auth($this_contribution->get_auth(), Contribution::CONTRIBUTION_AUTH_BIT) || AppContext::get_current_user()->get_id() == $this_contribution->get_poster_id()) { //On affiche seulement si on est dans le bon cadre d'affichage if ($num_contributions > CONTRIBUTIONS_PER_PAGE * ($page - 1) && $num_contributions <= CONTRIBUTIONS_PER_PAGE * $page) { $poster_group_color = User::get_group_color($this_contribution->get_poster_groups(), $this_contribution->get_poster_level()); $fixer_group_color = User::get_group_color($this_contribution->get_fixer_groups(), $this_contribution->get_fixer_level()); $template->assign_block_vars('contributions', array('C_POSTER_GROUP_COLOR' => !empty($poster_group_color), 'C_FIXER_GROUP_COLOR' => !empty($fixer_group_color), 'ENTITLED' => $this_contribution->get_entitled(), 'MODULE' => $this_contribution->get_module_name(), 'STATUS' => $this_contribution->get_status_name(), 'CREATION_DATE' => $creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'FIXING_DATE' => $fixing_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'POSTER' => $this_contribution->get_poster_login(), 'POSTER_LEVEL_CLASS' => UserService::get_level_class($this_contribution->get_poster_level()), 'POSTER_GROUP_COLOR' => $poster_group_color, 'FIXER' => $this_contribution->get_fixer_login(), 'FIXER_LEVEL_CLASS' => UserService::get_level_class($this_contribution->get_fixer_level()), 'FIXER_GROUP_COLOR' => $fixer_group_color, 'ACTIONS' => '', 'U_FIXER_PROFILE' => UserUrlBuilder::profile($this_contribution->get_fixer_id())->rel(), 'U_POSTER_PROFILE' => UserUrlBuilder::profile($this_contribution->get_poster_id())->rel(), 'U_CONSULT' => PATH_TO_ROOT . '/user/' . url('contribution_panel.php?id=' . $this_contribution->get_id()), 'C_FIXED' => $this_contribution->get_status() == Event::EVENT_STATUS_PROCESSED, 'C_PROCESSING' => $this_contribution->get_status() == Event::EVENT_STATUS_BEING_PROCESSED)); } $num_contributions++; } } $pagination = new ModulePagination($page, $num_contributions, CONTRIBUTIONS_PER_PAGE);