merge with master
[platal.git] / modules / profile.php
index 63e3370..894578a 100644 (file)
@@ -35,9 +35,11 @@ class ProfileModule extends PLModule
             'profile/ajax/address' => $this->make_hook('ajax_address', AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/tel'     => $this->make_hook('ajax_tel',     AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/medal'   => $this->make_hook('ajax_medal',   AUTH_COOKIE, 'user', NO_AUTH),
+            'profile/networking'   => $this->make_hook('networking',   AUTH_PUBLIC),
             'profile/ajax/job'     => $this->make_hook('ajax_job',     AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH),
             'profile/ajax/skill'   => $this->make_hook('ajax_skill',   AUTH_COOKIE, 'user', NO_AUTH),
+            'profile/ajax/searchname'   => $this->make_hook('ajax_searchname',   AUTH_COOKIE, 'user', NO_AUTH),
             'javascript/applis.js' => $this->make_hook('applis_js', AUTH_COOKIE),
             'javascript/grades.js' => $this->make_hook('grades_js', AUTH_COOKIE),
             'profile/medal'    => $this->make_hook('medal', AUTH_PUBLIC),
@@ -58,6 +60,7 @@ class ProfileModule extends PLModule
             'admin/formations' => $this->make_hook('admin_formations', AUTH_MDP, 'admin'),
             'admin/sections'  => $this->make_hook('admin_sections', AUTH_MDP, 'admin'),
             'admin/secteurs'  => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'),
+            'admin/networking' => $this->make_hook('admin_networking', AUTH_MDP, 'admin'),
             'admin/trombino'   => $this->make_hook('admin_trombino', AUTH_MDP, 'admin'),
             'admin/ss_secteurs'  => $this->make_hook('admin_ss_secteurs', AUTH_MDP, 'admin'),
             'admin/fonctions'  => $this->make_hook('admin_fonctions', AUTH_MDP, 'admin'),
@@ -123,6 +126,19 @@ class ProfileModule extends PLModule
         exit;
     }
 
+    function handler_networking(&$page, $mid)
+    {
+        $res = XDB::query("SELECT  icon
+                             FROM  profile_networking_enum
+                            WHERE  network_type = {?}",
+                          $mid);
+        $img  = dirname(__FILE__) . '/../htdocs/images/networking/' . $res->fetchOneCell();
+        $type = mime_content_type($img);
+        header("Content-Type: $type");
+        echo file_get_contents($img);
+        exit;
+    }
+
     function handler_photo_change(&$page)
     {
         global $globals;
@@ -386,14 +402,13 @@ class ProfileModule extends PLModule
         $page->assign('adr', array());
     }
 
-    function handler_ajax_tel(&$page, $adid, $telid)
+    function handler_ajax_tel(&$page, $prefid, $prefname, $telid)
     {
         header('Content-Type: text/html; charset=utf-8');
-        $page->changeTpl('profile/adresses.tel.tpl', NO_SKIN);
-        $page->assign('i', $adid);
-        $page->assign('adid', "addresses_$adid");
-        $page->assign('adpref', "addresses[$adid]");
-        $page->assign('t', $telid);
+        $page->changeTpl('profile/phone.tpl', NO_SKIN);
+        $page->assign('prefid', $prefid);
+        $page->assign('prefname', $prefname);
+        $page->assign('telid', $telid);
         $page->assign('tel', array());
     }
 
@@ -451,6 +466,15 @@ class ProfileModule extends PLModule
         }
     }
 
+    function handler_ajax_searchname(&$page, $snid)
+    {
+        header('Content-Type: text/html; charset=utf-8');
+        $page->changeTpl('profile/general.searchname.tpl', NO_SKIN);
+        $page->assign('i', $snid);
+        $page->assign('sn', array());
+        $page->assign('newsn', true);
+    }
+    
     function handler_p_orange(&$page)
     {
         $page->changeTpl('profile/orange.tpl');
@@ -808,6 +832,16 @@ class ProfileModule extends PLModule
         $table_editor->describe('label', 'intitulé', true);
         $table_editor->apply($page, $action, $id);
     }
+    function handler_admin_networking(&$page, $action = 'list', $id = null) {
+        $page->assign('xorg_title', 'Polytechnique.org - Administration - Networking');
+        $page->assign('title', 'Gestion des types de networking');
+        $table_editor = new PLTableEditor('admin/networking', 'profile_networking_enum', 'network_type');
+        $table_editor->describe('name', 'intitulé', true);
+        $table_editor->describe('icon', 'nom de l\'icône', false);
+        $table_editor->describe('filter', 'filtre', true);
+        $table_editor->describe('link', 'lien web', true);
+        $table_editor->apply($page, $action, $id);
+    }
     function handler_admin_medals(&$page, $action = 'list', $id = null) {
         $page->setTitle('Polytechnique.org - Administration - Distinctions');
         $page->assign('title', 'Gestion des Distinctions');