slt,
voila j aimerai modifier le ficher settings et plus particulièrement check_lock:
j'ai créé une class maintenance voici le code :voici le fichier action:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 <?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * Description of maitenance * * @author nlefebvre */ class Maintenance extends BaseForm { public function configure() { $this->widgetSchema['maintenance'] = new sfWidgetFormChoice(array( 'choices' => Maintenance::getStatusChoices(), 'multiple' => false, 'expanded' => true)); } public function getStatusChoices() { return self::$choices; } static public $choices = array( false =>'No',true => 'yes' ); } ?>mais sa me marque plain d'érreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public function executeIndex(sfWebRequest $request) { $this->mt= new Maintenance(); if ($request->isMethod('post')) // On vérifie que l'on a bien fait en post { $app_config_file = sfConfig::get('sf_app_config_dir')."/settings.yml"; $config_values = sfYaml::load($app_config_file); $config_values['all']['.settings']['check_lock']= $choices ; // à titre d'exemple $content = sfYaml::dump($config_values); file_put_contents($app_config_file, $content); } }
si qqun peu m'aider merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Notice: Undefined variable: choices in /Applications/MAMP/htdocs/cquesnel/apps/backend/modules/statistique/actions/actions.class.php on line 27 Warning: file_put_contents(/Applications/MAMP/htdocs/cquesnel/apps/backend/config/settings.yml) [function.file-put-contents]: failed to open stream: Permission denied in /Applications/MAMP/htdocs/cquesnel/apps/backend/modules/statistique/actions/actions.class.php on line 29 Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cquesnel/apps/backend/modules/statistique/actions/actions.class.php:27) in /usr/lib/php/symfony/response/sfWebResponse.class.php on line 336 Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cquesnel/apps/backend/modules/statistique/actions/actions.class.php:27) in /usr/lib/php/symfony/response/sfWebResponse.class.php on line 357
Partager