123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?php
- // $Id$
- /**
- * @file
- * Installer/uninstaller for FGCF module.
- */
- /**
- * Implementation of hook_install().
- */
- function fgcf_install() {
- $vocabulary = array(
- 'name' => 'FGCF Thème',
- 'description' => '',
- 'multiple' => 0,
- 'required' => 1,
- 'hierarchy' => 0,
- 'relations' => 1,
- 'module' => 'fgcf',
- 'weight' => 0,
- 'nodes' => array('fgcf_fiche' => 1),
- );
- taxonomy_save_vocabulary($vocabulary);
- $vocabulary = array(
- 'name' => 'FGCF Supports de cours',
- 'description' => 'Toute caractéristique de la formation, comme la présence de travaux pratiques, une évaluation, etc.',
- 'multiple' => 0,
- 'required' => 0,
- 'hierarchy' => 0,
- 'relations' => 1,
- 'module' => 'fgcf',
- 'weight' => 0,
- 'nodes' => array(),
- );
- taxonomy_save_vocabulary($vocabulary);
- $vocabulary = array(
- 'name' => 'FGCF Documents remis',
- 'description' => '',
- 'multiple' => 0,
- 'required' => 0,
- 'hierarchy' => 0,
- 'relations' => 1,
- 'module' => 'fgcf',
- 'weight' => 0,
- 'nodes' => array(),
- );
- taxonomy_save_vocabulary($vocabulary);
- $vocabulary = array(
- 'name' => 'FGCF Sanction',
- 'description' => '',
- 'multiple' => 1,
- 'required' => 0,
- 'hierarchy' => 0,
- 'relations' => 1,
- 'module' => 'fgcf',
- 'weight' => 0,
- 'nodes' => array(),
- );
- taxonomy_save_vocabulary($vocabulary);
- $vocabulary = array(
- 'name' => 'FGCF Public concerné',
- 'description' => '',
- 'multiple' => 0,
- 'required' => 0,
- 'hierarchy' => 0,
- 'relations' => 1,
- 'module' => 'fgcf',
- 'weight' => 0,
- 'nodes' => array(),
- );
- taxonomy_save_vocabulary($vocabulary);
- }
- /**
- * Rename "FGCF Thématique" vocabulary to "FGCF Thème", as per issue #642
- *
- * @return array
- */
- function fgcf_update_6101() {
- $sq = "UPDATE {vocabulary} SET name = 'FGCF Thème' WHERE name = 'FGCF Thématique'";
- $ret = array(update_sql($sq));
- return $ret;
- }
- /**
- * Rename "FGCF Public visé" vocabulary to "FGCF Public concerné", as per issue #642
- *
- * @return array
- */
- function fgcf_update_6102() {
- $sq = "UPDATE {vocabulary} SET name = 'FGCF Public concerné' WHERE name = 'FGCF Public visé'";
- $ret = array(update_sql($sq));
- return $ret;
- }
- /**
- * Deploy feature changes, as per issue #650.
- *
- * @return array
- */
- function fgcf_update_6103() {
- // Revert only the CCK field changes.
- features_revert(array('fgcf' => array('content')));
- // OR, to revert all components for all features :
- // features_revert();
- return array();
- }
- /**
- * Rename "FGCF Supports remis" and "FGCF Format de cours" vocabularies as per issue #642
- *
- * @return array
- */
- function fgcf_update_6104() {
- $ret = array();
- $sq = "UPDATE {vocabulary} SET name = 'FGCF Documents remis' WHERE name = 'FGCF Supports remis'";
- $ret[] = update_sql($sq);
- $sq = "UPDATE {vocabulary} SET name = 'FGCF Supports de cours' WHERE name = 'FGCF Format de cours'";
- $ret[] = update_sql($sq);
- $sq = "DELETE FROM {url_alias} WHERE src LIKE 'fgcf/%'";
- $ret[] = update_sql($sq);
- return $ret;
- }
- /**
- * Deploy feature changes for 'Thème' color banner on 'Formation' nodes, as per issue #653.
- *
- * @return array
- */
- function fgcf_update_6105() {
- features_revert();
- return array();
- }
- /**
- * Save color information in existing Thème nodes, as per issue #653.
- *
- * @return array
- */
- function fgcf_update_6106() {
- $ret = array();
- $colors = array(
- // Langue - Communication - Développement personnel
- 303 => '#4a4494', // or #b47829 ?
- // Santé - Sécurité- Permis
- 302 => '#f0bf02',
- // Informatique - Bureautique
- 301 => '#f0bf02',
- // Institution des courses
- 300 => '#004c37',
- // Droit - RH - Management
- 299 => '#444',
- // Corps de métiers
- 298 => '#00868c',
- // Espaces verts / Horticulture
- 297 => '#496213',
- );
- foreach ($colors as $nid => $color) {
- $node = node_load($nid);
- $node->field_fgcf_thematique_color = array(array('value' => $color));
- node_save($node);
- $ret[] = array('success' => TRUE, 'query' => t('Ajout de la couleur sur thème @title.', array('@title' => $node->title)));
- }
- return $ret;
- }
|