From: Thomas Minvielle Date: Wed, 5 Mar 2014 08:39:15 +0000 (+0100) Subject: Add a Manageurs page to the profile X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5613503eaa6ad7c7983d2e3b0a7a7bb563dc18f9;p=platal.git Add a Manageurs page to the profile --- diff --git a/modules/profile.php b/modules/profile.php index 42c93ed..5309cc9 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -301,7 +301,7 @@ class ProfileModule extends PLModule { global $globals; - if (in_array($hrpid, array('general', 'adresses', 'emploi', 'poly', 'deco', 'mentor', 'deltaten'))) { + if (in_array($hrpid, array('general', 'adresses', 'emploi', 'poly', 'deco', 'mentor', 'manageurs', 'deltaten'))) { $aux = $opened_tab; $opened_tab = $hrpid; $hrpid = $aux; @@ -337,6 +337,9 @@ class ProfileModule extends PLModule if ($viewPrivate) { $wiz->addPage('ProfilePageMentor', 'Mentoring', 'mentor'); } + if ($viewPrivate) { + $wiz->addPage('ProfilePageManageurs', 'Manageurs.com', 'manageurs'); + } if ($viewPrivate && $profile->isDeltatenEnabled(Profile::DELTATEN_OLD)) { $wiz->addPage('ProfilePageDeltaten', 'Opération N N-10', 'deltaten'); } diff --git a/modules/profile/manageurs.inc.php b/modules/profile/manageurs.inc.php new file mode 100644 index 0000000..112222b --- /dev/null +++ b/modules/profile/manageurs.inc.php @@ -0,0 +1,205 @@ +pid()); + while (list($id, $name) = $res->next()) { + $value[$id] = $name; + } + } else if (!is_array($value)) { + $value = array(); + } else if (count($value) > 10) { + Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10"); + $success = false; + } + ksort($value); + return $value; + } + + public function save(ProfilePage $page, $field, $value) + { + XDB::execute("DELETE FROM profile_mentor_country + WHERE pid = {?}", + $page->pid()); + foreach ($value as $id=>&$name) { + XDB::execute("INSERT INTO profile_mentor_country (pid, country) + VALUES ({?}, {?})", + $page->pid(), $id); + } + } + + public function getText($value) { + return implode(', ', $value); + } +} + +class ProfilePageManageurs extends ProfilePage +{ + protected $pg_template = 'profile/manageurs.tpl'; + + public function __construct(PlWizard $wiz) + { + parent::__construct($wiz); + $this->settings['manageurs_title'] = null; + $this->settings['manageurs_entry_year'] = null; + $this->settings['manageurs_project'] = null; + $this->settings['manageurs_visibility'] = null; + $this->settings['manageurs_email'] = null; + $this->settings['manageurs_push'] = null; + $this->settings['manageurs_anonymity'] = null; + $this->settings['manageurs_novelty'] = null; + $this->settings['manageurs_nl'] = null; + $this->settings['manageurs_survey'] = null; + $this->settings['manageurs_network'] = null; + } + + protected function _fetchData() + { + $res = XDB::query("SELECT title AS manageurs_title, entry_year AS manageurs_entry_year, project AS manageurs_project, + anonymity AS manageurs_anonymity, visibility AS manageurs_visibility, email AS manageurs_email, + communication AS manageurs_communication, push AS manageurs_push, network AS manageurs_network + FROM profile_manageurs + WHERE pid = {?}", + $this->pid()); + $this->values = $res->fetchOneAssoc(); + + $this->values['manageurs_anonymity'] = $this->values['manageurs_anonymity'] == 1; + + $communication = explode(',', $this->values['manageurs_communication']); + + $this->values['manageurs_novelty'] = in_array('novelties', $communication); + $this->values['manageurs_nl'] = in_array('nl',$communication); + $this->values['manageurs_survey'] = in_array('survey',$communication); + + $this->values['manageurs_network'] = $this->values['manageurs_network'] == 1; + } + + protected function _saveData() + { + if ($this->changed['manageurs_title']) { + XDB::execute('UPDATE profile_manageurs + SET title = {?} + WHERE pid = {?}', + $this->values['manageurs_title'], $this->pid()); + } + + if ($this->changed['manageurs_entry_year']) { + XDB::execute('UPDATE profile_manageurs + SET entry_year = {?} + WHERE pid = {?}', + $this->values['manageurs_entry_year'], $this->pid()); + } + + if ($this->changed['manageurs_project']) { + XDB::execute('UPDATE profile_manageurs + SET project = {?} + WHERE pid = {?}', + $this->values['manageurs_project'], $this->pid()); + } + + if ($this->changed['manageurs_visibility']) { + XDB::execute('UPDATE profile_manageurs + SET visibility = {?} + WHERE pid = {?}', + $this->values['manageurs_visibility'], $this->pid()); + } + + if ($this->changed['manageurs_email']) { + XDB::execute('UPDATE profile_manageurs + SET email = {?} + WHERE pid = {?}', + $this->values['manageurs_email'], $this->pid()); + } + + if ($this->changed['manageurs_push']) { + XDB::execute('UPDATE profile_manageurs + SET push = {?} + WHERE pid = {?}', + $this->values['manageurs_push'], $this->pid()); + } + + if ($this->changed['manageurs_anonymity']) { + XDB::execute('UPDATE profile_manageurs + SET anonymity = {?} + WHERE pid = {?}', + $this->values['manageurs_anonymity'], $this->pid()); + } + + if ($this->changed['manageurs_novelty'] || $this->changed['manageurs_nl'] || $this->changed['manageurs_survey']) { + $communication = array(); + if ($this->values['manageurs_novelty']) { + $communication[] = 'novelties'; + } + if ($this->values['manageurs_nl']) { + $communication[] = 'nl'; + } + if ($this->values['manageurs_survey']) { + $communication[] = 'survey'; + } + $communicationStr = implode(',', $communication); + + XDB::execute('UPDATE profile_manageurs + SET communication = {?} + WHERE pid = {?}', + $communicationStr, $this->pid()); + } + + if ($this->changed['manageurs_network']) { + XDB::execute('UPDATE profile_manageurs + SET network = {?} + WHERE pid = {?}', + $this->values['manageurs_network'], $this->pid()); + } + } + + public function _prepare(PlPage $page, $id) + { + } +} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: +?> diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index fd13c93..7d5bf2a 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -436,6 +436,7 @@ require_once dirname(__FILE__) . '/groups.inc.php'; require_once dirname(__FILE__) . '/decos.inc.php'; require_once dirname(__FILE__) . '/jobs.inc.php'; require_once dirname(__FILE__) . '/mentor.inc.php'; +require_once dirname(__FILE__) . '/manageurs.inc.php'; require_once dirname(__FILE__) . '/deltaten.inc.php'; // vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: diff --git a/templates/profile/manageurs.tpl b/templates/profile/manageurs.tpl new file mode 100644 index 0000000..66660dd --- /dev/null +++ b/templates/profile/manageurs.tpl @@ -0,0 +1,198 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2014 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +
{icon name=information title="Afficher ma fiche Manageurs"}Tu peux consulter ta fiche professionnelle sur Manageurs.com. +
+ + + + + + + + + + + + + + + + +
+
+ + {icon name="vcard" title="Manageurs"} +
+ Profil Manageurs.com +
+ Intitulé du profil : + + +
+ Année de début d'activité professionnelle : + + + (par exemple : 2008) +
+ Projet professionnel + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + {icon name="vcard" title="Manageurs"} +
+ Préférences Manageurs.com +
+ Mon profil doit être : + +
+ + +
+
+ Visibilité auprès des entreprises : + +
+ +
+ + +
+
+ Email de contact + Les offres d'entreprises, les messages de diplômés et la communication Manageurs seront envoyés à cette adresse. + + +
+ Manageurs peut m'envoyer des emails  + +
+ +
+ +
+ +
+
+ Offres personnalisées : + +
+ +
+ +
+ +
+
+ Partage avec les autres diplômés : + +
+ +
+ +
+
+ +{* vim:set et sw=2 sts=2 sws=2 fenc=utf-8: *} diff --git a/upgrade/manageurs/01_create_profile_manageurs.sql b/upgrade/manageurs/01_create_profile_manageurs.sql index 894995c..13c513a 100644 --- a/upgrade/manageurs/01_create_profile_manageurs.sql +++ b/upgrade/manageurs/01_create_profile_manageurs.sql @@ -3,12 +3,12 @@ CREATE TABLE profile_manageurs ( title VARCHAR(255) NOT NULL DEFAULT '', entry_year INT(4) NULL DEFAULT NULL, project MEDIUMTEXT NULL DEFAULT NULL, - anonymity INT(1) UNSIGNED NOT NULL DEFAULT 0, + anonymity TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, visibility ENUM('visible', 'visible_exceptions', 'blocked') NOT NULL DEFAULT 'blocked', + email VARCHAR(255) NOT NULL DEFAULT '', communication SET('novelties', 'nl', 'survey') NOT NULL DEFAULT '', push ENUM('unique', 'weekly', 'never') NOT NULL DEFAULT 'never', - email VARCHAR(255) NOT NULL DEFAULT '', - network INT(1) UNSIGNED NOT NULL DEFAULT 0, + network TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (pid), CONSTRAINT FOREIGN KEY (pid) REFERENCES profiles (pid) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;