Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 20-02-2009 12:29:01

tabine
Nouveau membre
Date d'inscription: 20-02-2009
Messages: 4

Probleme d 'inclusion d une library sur zend

j utilise une bibliotheque externe jpgraph a zend je le met dans le dossier library et je l ajoute dans mon path commme suis

set_include_path('.'
    . PATH_SEPARATOR . './library'
    . PATH_SEPARATOR . './jpgraph'
    . PATH_SEPARATOR . './Artichow'
    . PATH_SEPARATOR . './application/models/'
    . PATH_SEPARATOR . './application'
    . PATH_SEPARATOR . './application/Plugins/'
    . PATH_SEPARATOR . './application/modules/'
    . PATH_SEPARATOR . './application/config/'
    . PATH_SEPARATOR . get_include_path());
   
    include "Zend/Loader.php";
    Zend_Loader::registerAutoload();

Dans mon action j ai besoin d une class  qui est dans fichier jpgraph_pie.php qui est dans la library sur  une action de mon controlleur voici la class

<?php
/*=======================================================================
// File:    JPGRAPH_PIE.PHP
// Description:    Pie plot extension for JpGraph
// Created:     2001-02-14
// Ver:        $Id: jpgraph_pie.php 1091 2009-01-18 22:57:40Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/


// Defines for PiePlot::SetLabelType()
define("PIE_VALUE_ABS",1);
define("PIE_VALUE_PER",0);
define("PIE_VALUE_PERCENTAGE",0);
define("PIE_VALUE_ADJPERCENTAGE",2);
define("PIE_VALUE_ADJPER",2);

//===================================================
// CLASS PiePlot
// Description: Draws a pie plot
//===================================================
class PiePlot {
    public $posx=0.5,$posy=0.5;
    protected $radius=0.3;
    protected $explode_radius=array(),$explode_all=false,$explode_r=20;
    protected $labels=null, $legends=null;
    protected $csimtargets=null,$csimwintargets=null;  // Array of targets for CSIM
    protected $csimareas='';        // Generated CSIM text   
    protected $csimalts=null;        // ALT tags for corresponding target
    protected $data=null;
    public $title;
    protected $startangle=0;
    protected $weight=1, $color="black";
    protected $legend_margin=6,$show_labels=true;
    protected $themearr = array(
    "earth"     => array(136,34,40,45,46,62,63,134,74,10,120,136,141,168,180,77,209,218,346,395,89,430),
    "pastel" => array(27,415,128,59,66,79,105,110,42,147,152,230,236,240,331,337,405,38),
    "water"  => array(8,370,24,40,335,56,213,237,268,14,326,387,10,388),
    "sand"   => array(27,168,34,170,19,50,65,72,131,209,46,393));
    protected $theme="earth";
    protected $setslicecolors=array();
    protected $labeltype=0; // Default to percentage
    protected $pie_border=true,$pie_interior_border=true;
    public $value;
    protected $ishadowcolor='',$ishadowdrop=4;
    protected $ilabelposadj=1;
    protected $legendcsimtargets = array(),$legendcsimwintargets = array();
    protected $legendcsimalts = array();
    protected $adjusted_data = array();
    public $guideline = null;
    protected $guidelinemargin=10,$iShowGuideLineForSingle = false;
    protected $iGuideLineCurve = false,$iGuideVFactor=1.4,$iGuideLineRFactor=0.8;
    protected $la = array(); // Holds the exact angle for each label
   
//---------------
// CONSTRUCTOR
    function PiePlot($data) {
    $this->data = array_reverse($data);
    $this->title = new Text("");
    $this->title->SetFont(FF_FONT1,FS_BOLD);
    $this->value = new DisplayValue();
    $this->value->Show();
    $this->value->SetFormat('%.1f%%');
    $this->guideline = new LineProperty();
    }

//---------------
// PUBLIC METHODS   
    function SetCenter($x,$y=0.5) {
    $this->posx = $x;
    $this->posy = $y;
    }

    // Enable guideline and set drwaing policy
    function SetGuideLines($aFlg=true,$aCurved=true,$aAlways=false) {
    $this->guideline->Show($aFlg);
    $this->iShowGuideLineForSingle = $aAlways;
    $this->iGuideLineCurve = $aCurved;
    }

    // Adjuste the distance between labels and labels and pie
    function SetGuideLinesAdjust($aVFactor,$aRFactor=0.8) {
    $this->iGuideVFactor=$aVFactor;
    $this->iGuideLineRFactor=$aRFactor;
    }

    function SetColor($aColor) {
    $this->color = $aColor;
    }

j obtiens l erreur ci dessous quelqu un pourrai me donner un coupde pouce


Warning: Zend_Loader::include_once(Text.php) [function.Zend-Loader-include-once]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP 2.0b1\www\teste\library\Zend\Loader.php on line 83

Warning: Zend_Loader::include_once() [function.include]: Failed opening 'Text.php' for inclusion (include_path='.;./library;./jpgraph;./application/models/;./application;./application/Plugins/;./application/modules/;./application/config/;.;C:\PROGRA~1\EASYPH~1.0B1\\php5\pear\') in C:\Program Files\EasyPHP 2.0b1\www\teste\library\Zend\Loader.php on line 83

Fatal error: Class 'Text' not found in C:\Program Files\EasyPHP 2.0b1\www\teste\application\models\PiePlot.php on line 49

merci

Hors ligne

 

#2 20-02-2009 12:58:03

mikaelkael
Administrateur
Lieu: Donges
Date d'inscription: 18-06-2007
Messages: 1176
Site web

Re: Probleme d 'inclusion d une library sur zend

Hello,

Avec jpGraph, il faut faire les include ou require manuellement car il ne respecte les conventions de nommage (PEAR ou Zend). L'autoload ne fonctionne pas.

A+


Less code = less bugs
Contributeur ZF - ZCE - ZFCE - Doc ZF (CHM & PDF) - Vice-trésorier AFUP 2011
Ubuntu 11.04 - ZendServer

Hors ligne

 

Pied de page des forums

Propulsé par PunBB
© Copyright 2002–2005 Rickard Andersson
Traduction par punbb.fr

Graphisme réalisé par l'agence Rodolphe Eveilleau
Développement par Kitpages