当前位置: 首页>>代码示例>>PHP>>正文


PHP create_exdir函数代码示例

本文整理汇总了PHP中create_exdir函数的典型用法代码示例。如果您正苦于以下问题:PHP create_exdir函数的具体用法?PHP create_exdir怎么用?PHP create_exdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_exdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write_file

	/**
     *      Write the object to document file to disk
     *      @param      socid
     *      @param      catid
     *      @param      outputlangs     Lang object for output language
     *      @return     int             1=OK, 0=KO
	 */
	function write_file($socid = 0, $catid = 0, $outputlangs='')
	{
		global $user,$conf,$langs;

		if (! is_object($outputlangs)) $outputlangs=$langs;
		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
		if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';

		$outputlangs->load("main");
		$outputlangs->load("dict");
		$outputlangs->load("companies");
		$outputlangs->load("bills");
		$outputlangs->load("products");

        $dir = $conf->agenda->dir_temp."/";
		$file = $dir . "actions-".$this->month."-".$this->year.".pdf";

		if (! file_exists($dir))
		{
			if (create_exdir($dir) < 0)
			{
				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
				return 0;
			}
		}

		if (file_exists($dir))
		{
            $pdf=pdf_getInstance($this->format);

            if (class_exists('TCPDF'))
            {
                $pdf->setPrintHeader(false);
                $pdf->setPrintFooter(false);
            }
            $pdf->SetFont(pdf_getPDFFont($outputlangs));

			$pdf->Open();
			$pagenb=0;
			$pdf->SetDrawColor(128,128,128);
			$pdf->SetFillColor(220,220,220);

			$pdf->SetTitle($outputlangs->convToOutputCharset($this->title));
			$pdf->SetSubject($outputlangs->convToOutputCharset($this->subject));
			$pdf->SetCreator("Dolibarr ".DOL_VERSION);
			$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
			$pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject));

			$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);   // Left, Top, Right
			$pdf->SetAutoPageBreak(1,0);

			$nbpage = $this->_pages($pdf, $outputlangs);

			$pdf->AliasNbPages();
			$pdf->Close();

			$pdf->Output($file,'F');
			if (! empty($conf->global->MAIN_UMASK))
			@chmod($file, octdec($conf->global->MAIN_UMASK));

			return 1;
		}
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:70,代码来源:rapport.pdf.php

示例2: add_to_target

	/**
	 *    \brief      Ajoute destinataires dans table des cibles
	 *    \param      mailing_id    Id of emailing
	 *    \param      filterarray   Requete sql de selection des destinataires
	 *    \return     int           < 0 si erreur, nb ajout si ok
	 */
	function add_to_target($mailing_id,$filtersarray=array())
	{
		global $conf,$langs,$_FILES;

		require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

		// For compatibility with Unix, MS-Dos or Macintosh
		ini_set('auto_detect_line_endings', true);

		$cibles = array();

		$upload_dir=$conf->mailing->dir_temp;

		if (create_exdir($upload_dir) >= 0)
		{
			$resupload = dol_move_uploaded_file($_FILES['username']['tmp_name'], $upload_dir . "/" . $_FILES['username']['name'], 1, 0, $_FILES['username']['error']);
			if (is_numeric($resupload) && $resupload > 0)
			{
				$cpt=0;

				//$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
				//print_r($_FILES);
				$file=$upload_dir . "/" . $_FILES['username']['name'];
				$handle = @fopen($file, "r");
				if ($handle)
				{
					$i = 0;
		            $j = 0;

            		$old = '';
					while (!feof($handle))
					{
						$cpt++;
				        $buffer = trim(fgets($handle));
			        	$tab=explode(';',$buffer,4);
				        $email=$tab[0];
				        $name=$tab[1];
				        $firstname=$tab[2];
				        $other=$tab[3];
				        if (! empty($buffer))
				        {
			        		//print 'xx'.dol_strlen($buffer).empty($buffer)."<br>\n";
				        	$id=$cpt;
					        if (isValidEMail($email))
					        {
		   						if ($old <> $email)
								{
									$cibles[$j] = array(
					                    			'email' => $email,
					                    			'name' => $name,
					                    			'firstname' => $firstname,
													'other' => $other,
                                                    'source_url' => '',
                                                    'source_id' => '',
                                                    'source_type' => 'file'
									);
									$old = $email;
									$j++;
								}
					        }
					        else
					        {
					        	$i++;
					        	$langs->load("errors");
					        	$this->error = $langs->trans("ErrorFoundBadEmailInFile",$i,$cpt,$email);
					        }
				        }
				    }
				    fclose($handle);

				    if ($i > 0)
				    {
				    	return -$i;
				    }
				}
				else
				{
					$this->error = $langs->trans("ErrorFaildToOpenFile");
					return -1;
				}

				dol_syslog(get_class($this)."::add_to_target mailing ".$cpt." targets found");
			}
			else
			{
				$langs->load("errors");
				if ($resupload < 0)	// Unknown error
				{
					$this->error = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
				}
				else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload))	// Files infected by a virus
				{
					$this->error = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
				}
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:peche.modules.php

示例3: build_file

	/**
	 *      \brief      Build export file
	 *      \param      user                User that export
	 *      \param      model               Export format
	 *      \param      datatoexport        Name of dataset to export
	 *      \param      array_selected      Filter on array of fields to export
	 *      \param		sqlquery = ''		if set, transmit a sql query instead of building it from arrays
	 *      \remarks    Les tableaux array_export_xxx sont deja chargees pour le bon datatoexport
	 *                  aussi le parametre datatoexport est inutilise
	 */
	function build_file($user, $model, $datatoexport, $array_selected, $sqlquery = '')
 	{
		global $conf,$langs;

		$indice=0;
		asort($array_selected);

		dol_syslog("Export::build_file $model, $datatoexport, $array_selected");

		// Creation de la classe d'export du model ExportXXX
		$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
		$file = "export_".$model.".modules.php";
		$classname = "Export".$model;
		require_once($dir.$file);
		$objmodel = new $classname($db);

		if ($sqlquery) $sql = $sqlquery;
        else $sql=$this->build_sql($indice,$array_selected);

		// Run the sql
		$this->sqlusedforexport=$sql;
		dol_syslog("Export::build_file sql=".$sql);
		$resql = $this->db->query($sql);
		if ($resql)
		{
			//$this->array_export_label[$indice]
			$filename="export_".$datatoexport;
			$filename.='.'.$objmodel->getDriverExtension();
			$dirname=$conf->export->dir_temp.'/'.$user->id;

			$outputlangs=$langs;	// Lang for output

			// Open file
			create_exdir($dirname);
			$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);

			if ($result >= 0)
			{
				// Genere en-tete
				$objmodel->write_header($outputlangs);

				// Genere ligne de titre
				$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs);

				while ($objp = $this->db->fetch_object($resql))
				{
					$var=!$var;

					// Process special operations
					if (! empty($this->array_export_special[$indice]))
					{
						foreach ($this->array_export_special[$indice] as $key => $value)
						{
							if (! array_key_exists($key, $array_selected)) continue;		// Field not selected
							// Operation NULLIFNEG
							if ($this->array_export_special[$indice][$key]=='NULLIFNEG')
							{
								//$alias=$this->array_export_alias[$indice][$key];
								$alias=str_replace(array('.', '-'),'_',$key);
								if ($objp->$alias < 0) $objp->$alias='';
							}
							// Operation ZEROIFNEG
							if ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
							{
								//$alias=$this->array_export_alias[$indice][$key];
								$alias=str_replace(array('.', '-'),'_',$key);
								if ($objp->$alias < 0) $objp->$alias='0';
							}
						}
					}
					// end of special operation processing

					$objmodel->write_record($array_selected,$objp,$outputlangs);
				}

				// Genere en-tete
				$objmodel->write_footer($outputlangs);

				// Close file
				$objmodel->close_file();
			}
			else
			{
				$this->error=$objmodel->error;
				dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
				return -1;
			}
		}
		else
		{
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:export.class.php

示例4: get_exdir

         $langs->load("errors");
         $message .= '<div class="error">' . $langs->trans("ErrorLoginAlreadyExists", $edituser->login) . '</div>';
     } else {
         $message .= '<div class="error">' . $edituser->error . '</div>';
     }
 }
 if ($ret >= 0 && !count($edituser->errors)) {
     if (GETPOST('deletephoto') && $edituser->photo) {
         $fileimg = $conf->user->dir_output . '/' . get_exdir($edituser->id, 2, 0, 1) . '/logos/' . $edituser->photo;
         $dirthumbs = $conf->user->dir_output . '/' . get_exdir($edituser->id, 2, 0, 1) . '/logos/thumbs';
         dol_delete_file($fileimg);
         dol_delete_dir_recursive($dirthumbs);
     }
     if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) {
         $dir = $conf->user->dir_output . '/' . get_exdir($edituser->id, 2, 0, 1);
         create_exdir($dir);
         if (@is_dir($dir)) {
             $newfile = $dir . '/' . dol_sanitizeFileName($_FILES['photo']['name']);
             $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']);
             if (!$result > 0) {
                 $message .= '<div class="error">' . $langs->trans("ErrorFailedToSaveFile") . '</div>';
             } else {
                 // Create small thumbs for company (Ratio is near 16/9)
                 // Used on logon for example
                 $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
                 // Create mini thumbs for company (Ratio is near 16/9)
                 // Used on menu or for setup page for example
                 $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
             }
         }
     }
开发者ID:netors,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例5: write_file

	/**
	 *		\brief      Function to build PDF on disk, then output on HTTP strem.
	 *		\param	    arrayofmembers	Array of members informations
	 *		\param		outputlangs		Lang object for output language
	 *		\return	    int     		1=ok, 0=ko
	 */
	function write_file($arrayofmembers,$outputlangs)
	{
		global $user,$conf,$langs,$mysoc,$_Avery_Labels;

		// Choose type (CARD by default)
		$this->code=empty($conf->global->ADHERENT_CARD_TYPE)?'CARD':$conf->global->ADHERENT_CARD_TYPE;
		$this->Tformat = $_Avery_Labels[$this->code];
		if (empty($this->Tformat)) { dol_print_error('','ErrorBadTypeForCard'.$this->code); exit; }
		$this->type = 'pdf';
		$this->format = $this->Tformat['paper-size'];

		if (! is_object($outputlangs)) $outputlangs=$langs;
		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
		if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';

		$outputlangs->load("main");
		$outputlangs->load("dict");
		$outputlangs->load("companies");
		$outputlangs->load("members");
		$outputlangs->load("admin");


		$dir = $conf->adherent->dir_temp;
		$file = $dir . "/tmpcards.pdf";

		if (! file_exists($dir))
		{
			if (create_exdir($dir) < 0)
			{
				$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
				return 0;
			}
		}

        $pdf=pdf_getInstance($this->format,$this->Tformat['metric']);

        if (class_exists('TCPDF'))
        {
            $pdf->setPrintHeader(false);
            $pdf->setPrintFooter(false);
        }
        $pdf->SetFont(pdf_getPDFFont($outputlangs));

		$pdf->SetTitle($outputlangs->transnoentities('MembersCards'));
		$pdf->SetSubject($outputlangs->transnoentities("MembersCards"));
		$pdf->SetCreator("Dolibarr ".DOL_VERSION);
		$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
		$pdf->SetKeyWords($outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name));
		if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);

		$pdf->SetMargins(0,0);
		$pdf->SetAutoPageBreak(false);

		$this->_Metric_Doc = $this->Tformat['metric'];
		// Permet de commencer l'impression de l'etiquette desiree dans le cas ou la page a deja servie
		$posX=1;
		$posY=1;
		if ($posX > 0) $posX--; else $posX=0;
		if ($posY > 0) $posY--; else $posY=0;
		$this->_COUNTX = $posX;
		$this->_COUNTY = $posY;
		$this->_Set_Format($pdf, $this->Tformat);


		$pdf->Open();
		$pdf->AddPage();


		// Add each record
		foreach($arrayofmembers as $val)
		{
			// imprime le texte specifique sur la carte
			$this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['id'],$val['photo']);
		}

		//$pdf->SetXY(10, 295);
		//$pdf->Cell($this->_Width, $this->_Line_Height, 'XXX',0,1,'C');


		// Output to file
		$pdf->Output($file,'F');

		if (! empty($conf->global->MAIN_UMASK))
			@chmod($file, octdec($conf->global->MAIN_UMASK));



		// Output to http stream
		clearstatcache();

		$attachment=true;
		if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
		$filename='tmpcards.pdf';
		$type=dol_mimetype($filename);
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:pdf_standard.class.php

示例6: if

$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;



/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/

// Upload file
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
	require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

	if (create_exdir($upload_dir) >= 0)
	{
		$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
		if (is_numeric($resupload) && $resupload > 0)
		{
		    $result=$ecmdir->changeNbOfFiles('+');
	    }
	    else
	    {
   			$langs->load("errors");
			if ($resupload < 0)	// Unknown error
			{
				$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
			}
			else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload))	// Files infected by a virus
			{
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:docmine.php

示例7:

		$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("File"));
		$error++;
	}
	else
	{
		if (! preg_match('/\.tgz/i',$original_file))
		{
			$mesg=$langs->trans("ErrorFileMustBeADolibarrPackage");
			$error++;
		}
	}

	if (! $error)
	{
		@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
		create_exdir($conf->admin->dir_temp.'/'.$original_file);

		$result=dol_move_uploaded_file($_FILES["fileinstall"]["tmp_name"],$newfile,1,0,$_FILES['fileinstall']['error']);
		if ($result > 0)
		{
			//dol_uncompress($newfile);
		}
	}
}


/*
 * View
 */

$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon';
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:update.php

示例8: Create


//.........这里部分代码省略.........

                if ($resql)
                {
                    $row = $this->db->fetch_row($resql);
                }
                else
                {
                    $error++;
                    dol_syslog("Erreur recherche reference");
                }

                $ref = $ref . substr("00".($row[0]+1), -2);

                $filebonprev = $ref;

                // Create withdraw receipt in database
                $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
                $sql.= " ref, entity, datec";
                $sql.= ") VALUES (";
                $sql.= "'".$ref."'";
                $sql.= ", ".$conf->entity;
                $sql.= ", '".$this->db->idate(mktime())."'";
                $sql.= ")";

            	dol_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
                $resql = $this->db->query($sql);

                if ($resql)
                {
                    $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");

                    $dir=$conf->prelevement->dir_output.'/receipts';
                    $file=$filebonprev;
                    if (! is_dir($dir)) create_exdir($dir);

                    $bonprev = new BonPrelevement($this->db, $dir."/".$file);
                    $bonprev->id = $prev_id;
                }
                else
                {
                    $error++;
                    dol_syslog("Erreur creation du bon de prelevement");
                }
            }

            /*
             * Creation process
             *
             */
			if (!$error)
			{
				if (sizeof($factures_prev) > 0)
				{
					foreach ($factures_prev as $fac)
					{
						// Fetch invoice
						$fact = new Facture($this->db);
						$fact->fetch($fac[0]);
						/*
						 * Add standing order
						 *
						 *
						 * $fac[3] : banque
						 * $fac[4] : guichet
						 * $fac[5] : number
						 * $fac[6] : cle rib
开发者ID:remyyounes,项目名称:dolibarr,代码行数:67,代码来源:bon-prelevement.class.php

示例9: create

	/**
	 *      Create record into database
	 *      @param      user        User that create
	 *      @return     int         <0 if KO, >0 if OK
	 */
	function create($user)
	{
		global $conf, $langs;

		$now=dol_now();

		// Clean parameters
		$this->label=dol_sanitizeFileName(trim($this->label));
		$this->fk_parent=trim($this->fk_parent);
		$this->description=trim($this->description);
		if (! $this->cachenbofdoc) $this->cachenbofdoc=0;
		$this->date_c=$now;
		$this->fk_user_c=$user->id;
		if ($this->fk_parent <= 0) $this->fk_parent=0;


		// Check if same directory does not exists with this name
		$relativepath=$this->label;
		if ($this->fk_parent)
		{
			$parent = new ECMDirectory($this->db);
			$parent->fetch($this->fk_parent);
			$relativepath=$parent->getRelativePath().$relativepath;
		}
		$relativepath=preg_replace('/([\/])+/i','/',$relativepath);	// Avoid duplicate / or \
		//print $relativepath.'<br>';

		$cat = new ECMDirectory($this->db);
		$cate_arbo = $cat->get_full_arbo(1);
		$pathfound=0;
		foreach ($cate_arbo as $key => $categ)
		{
			$path=str_replace($this->forbiddenchars,'_',$categ['fulllabel']);
			//print $path.'<br>';
			if ($path == $relativepath)
			{
				$pathfound=1;
				break;
			}
		}

		if ($pathfound)
		{
			$this->error="ErrorDirAlreadyExists";
			dol_syslog("EcmDirectories::create ".$this->error, LOG_WARNING);
			return -1;
		}
		else
		{
			$this->db->begin();

			// Insert request
			$sql = "INSERT INTO ".MAIN_DB_PREFIX."ecm_directories(";
			$sql.= "label,";
			$sql.= "entity,";
			$sql.= "fk_parent,";
			$sql.= "description,";
			$sql.= "cachenbofdoc,";
			$sql.= "date_c,";
			$sql.= "fk_user_c";
			$sql.= ") VALUES (";
			$sql.= " '".$this->db->escape($this->label)."',";
			$sql.= " '".$conf->entity."',";
			$sql.= " '".$this->fk_parent."',";
			$sql.= " '".$this->db->escape($this->description)."',";
			$sql.= " ".($this->cachenbofdoc).",";
			$sql.= " '".$this->db->idate($this->date_c)."',";
			$sql.= " '".$this->fk_user_c."'";
			$sql.= ")";

			dol_syslog("EcmDirectories::create sql=".$sql, LOG_DEBUG);
			$resql=$this->db->query($sql);
			if ($resql)
			{
				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");

				$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
				$result=create_exdir($dir);

				// Appel des triggers
				include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
				$interface=new Interfaces($this->db);
				$result=$interface->run_triggers('MYECMDIR_CREATE',$this,$user,$langs,$conf);
				if ($result < 0) { $error++; $this->errors=$interface->errors; }
				// Fin appel triggers

				if (! $error)
				{
					$this->db->commit();
					return $this->id;
				}
				else
				{
					$this->db->rollback();
					return -1;
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:ecmdirectory.class.php

示例10: CreateColorIcon

	/**
	 *		Creation d'un icone de couleur
	 *		@param	color		Couleur de l'image
	 *		@param	module  Nom du module
	 *		@param	name	  Nom de l'image
	 *		@param	x       Largeur de l'image en pixels
	 *		@param	y       Hauteur de l'image en pixels
	 */
	function CreateColorIcon($color,$module,$name,$x='12',$y='12')
	{
		global $conf;

		$file = $conf->$module->dir_temp.'/'.$name.'.png';

		// On cree le repertoire contenant les icones
		if (! file_exists($conf->$module->dir_temp))
		{
			create_exdir($conf->$module->dir_temp);
		}

		// On cree l'image en vraies couleurs
		$image = imagecreatetruecolor($x,$y);

		$color = substr($color,1,6);

		$rouge = hexdec(substr($color,0,2)); //conversion du canal rouge
		$vert  = hexdec(substr($color,2,2)); //conversion du canal vert
		$bleu  = hexdec(substr($color,4,2)); //conversion du canal bleu

		$couleur = imagecolorallocate($image,$rouge,$vert,$bleu);
		//print $rouge.$vert.$bleu;
		imagefill($image,0,0,$couleur); //on remplit l'image
		// On cree la couleur et on l'attribue a une variable pour ne pas la perdre
		ImagePng($image,$file); //renvoie une image sous format png
		ImageDestroy($image);
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:36,代码来源:html.formother.class.php

示例11: write_file

	/**
	 *		\brief      Fonction generant le document sur le disque
	 *		\param	    object			Objet expedition a generer (ou id si ancienne methode)
	 *		\param		outputlangs		Lang output object
	 * 	 	\return	    int     		1=ok, 0=ko
	 */
	function write_file(&$object, $outputlangs)
	{
		global $user,$conf,$langs,$mysoc;
		$default_font_size = pdf_getPDFFontSize($outputlangs);

		$object->fetch_thirdparty();

		if (! is_object($outputlangs)) $outputlangs=$langs;
		// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
		if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';

		$outputlangs->load("main");
		$outputlangs->load("dict");
		$outputlangs->load("companies");
		$outputlangs->load("bills");
		$outputlangs->load("products");
		$outputlangs->load("propal");
		$outputlangs->load("sendings");
		$outputlangs->load("deliveries");

		//Generation de la fiche
		$this->expe = $object;

		//Verification de la configuration
		if ($conf->expedition->dir_output)
		{
			$object->fetch_thirdparty();

			$origin = $object->origin;

			//Creation de l expediteur
			$this->expediteur = $mysoc;

			//Creation du destinataire
			$idcontact = $object->$origin->getIdContact('external','SHIPPING');
            $this->destinataire = new Contact($this->db);
			if ($idcontact[0]) $this->destinataire->fetch($idcontact[0]);

			//Creation du livreur
			$idcontact = $object->$origin->getIdContact('internal','LIVREUR');
			$this->livreur = new User($this->db);
			if ($idcontact[0]) $this->livreur->fetch($idcontact[0]);


			// Definition de $dir et $file
			if ($object->specimen)
			{
				$dir = $conf->expedition->dir_output."/sending";
				$file = $dir . "/SPECIMEN.pdf";
			}
			else
			{
				$expref = dol_sanitizeFileName($object->ref);
				$dir = $conf->expedition->dir_output . "/sending/" . $expref;
				$file = $dir . "/" . $expref . ".pdf";
			}

			if (! file_exists($dir))
			{
				if (create_exdir($dir) < 0)
				{
					$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
					return 0;
				}
			}

			//Si le dossier existe
			if (file_exists($dir))
			{
                $pdf=pdf_getInstance($this->format,'mm','l');

			    if (class_exists('TCPDF'))
                {
                    $pdf->setPrintHeader(false);
                    $pdf->setPrintFooter(false);
                }
                $pdf->SetFont(pdf_getPDFFont($outputlangs));

				$pdf->Open();
				$pagenb=0;
				$pdf->SetDrawColor(128,128,128);

				//Generation de l entete du fichier
				$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
				$pdf->SetSubject($outputlangs->transnoentities("Sending"));
				$pdf->SetCreator("Dolibarr ".DOL_VERSION);
				$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
				$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
				if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);

				$pdf->SetMargins(10, 10, 10);
				$pdf->SetAutoPageBreak(1,0);

				$pdf->SetFont('','', $default_font_size - 3);
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:pdf_expedition_merou.modules.php

示例12: write_file

	/**
	 *	Function to build a document on disk using the generic odt module.
	 *	@param	    object				Object source to build document
	 *	@param		outputlangs			Lang output object
	 * 	@param		srctemplatepath	Full path of source filename for generator using a template file
	 *	@return	    int         		1 if OK, <=0 if KO
	 */
	function write_file($object,$outputlangs,$srctemplatepath)
	{
		global $user,$langs,$conf,$mysoc;

		if (empty($srctemplatepath))
		{
			dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
			return -1;
		}

		if (! is_object($outputlangs)) $outputlangs=$langs;
		$sav_charset_output=$outputlangs->charset_output;
		$outputlangs->charset_output='UTF-8';

		$outputlangs->load("main");
		$outputlangs->load("dict");
		$outputlangs->load("companies");
		$outputlangs->load("projects");

		if ($conf->societe->dir_output)
		{
			// If $object is id instead of object
			if (! is_object($object))
			{
				$id = $object;
				$object = new Societe($this->db);
				$object->fetch($id);

				if ($result < 0)
				{
					dol_print_error($db,$object->error);
					return -1;
				}
			}

			$objectref = dol_sanitizeFileName($object->id);
			$dir = $conf->societe->dir_output;
			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
			$file = $dir . "/" . $objectref . ".odt";

			if (! file_exists($dir))
			{
				if (create_exdir($dir) < 0)
				{
					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
					return -1;
				}
			}

			if (file_exists($dir))
			{
				//print "srctemplatepath=".$srctemplatepath;	// Src filename
				$newfile=basename($srctemplatepath);
				$newfiletmp=preg_replace('/\.odt/i','',$newfile);
				$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
				//print "newdir=".$dir;
				//print "newfile=".$newfile;
				//print "file=".$file;
				//print "conf->societe->dir_temp=".$conf->societe->dir_temp;

				create_exdir($conf->societe->dir_temp);

				// Open and load template
				require_once(DOL_DOCUMENT_ROOT.'/includes/odtphp/odf.php');
				$odfHandler = new odf($srctemplatepath, array(
						'PATH_TO_TMP'	  => $conf->societe->dir_temp,
						'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
						'DELIMITER_LEFT'  => '{',
						'DELIMITER_RIGHT' => '}')
				);

				//print $odfHandler->__toString()."\n";

				// Make substitutions into odt of user info
			    $tmparray=$this->get_substitutionarray_user($user,$outputlangs);
                //var_dump($tmparray); exit;
                foreach($tmparray as $key=>$value)
                {
                    try {
                        if (preg_match('/logo$/',$key)) // Image
                        {
                            //var_dump($value);exit;
                            if (file_exists($value)) $odfHandler->setImage($key, $value);
                            else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                        }
                        else    // Text
                        {
                            //print $key.' '.$value;exit;
                            $odfHandler->setVars($key, $value, true, 'UTF-8');
                        }
                    }
                    catch(OdfException $e)
                    {
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:doc_generic_odt.modules.php

示例13: dump

 /**
  * 	\brief		Dump a LDAP message to ldapinput.in file
  *	\param		dn			DN entry key
  *	\param		info		Attributes array
  *	\return		int			<0 if KO, >0 if OK
  */
 function dump($dn, $info)
 {
     global $conf;
     // Create content
     $content = $this->dump_content($dn, $info);
     //Create file
     $result = create_exdir($conf->ldap->dir_temp);
     $file = $conf->ldap->dir_temp . '/ldapinput.in';
     $fp = fopen($file, "w");
     if ($fp) {
         fputs($fp, $content);
         fclose($fp);
         if (!empty($conf->global->MAIN_UMASK)) {
             @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
         }
         return 1;
     } else {
         return -1;
     }
 }
开发者ID:netors,项目名称:dolibarr,代码行数:26,代码来源:ldap.class.php

示例14:

			$dir[2] = "$main_data_dir/propale";
			$dir[3] = "$main_data_dir/mycompany";
			$dir[4] = "$main_data_dir/ficheinter";
			$dir[5] = "$main_data_dir/produit";
			$dir[6] = "$main_data_dir/rapport";

			// Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas
			for ($i = 0 ; $i < sizeof($dir) ; $i++)
			{
				if (is_dir($dir[$i]))
				{
					dolibarr_install_syslog("etape1: Directory '".$dir[$i]."' exists");
				}
				else
				{
					if (create_exdir($dir[$i]) < 0)
					{
						print "<tr><td>";
						print "Failed to create directory: ".$dir[$i];
						print '</td><td>';
						print $langs->trans("Error");
						print "</td></tr>";
						$error++;
					}
					else
					{
						dolibarr_install_syslog("etape1: Directory '".$dir[$i]."' created");
					}
				}
			}
			if ($error)
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:etape1.php

示例15: init

    /**
     *      Function called when module is enabled.
     *      The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
     *      It also creates data directories.
     *      @return     int             1 if OK, 0 if KO
     */
	function init($options='')
	{
		global $conf;

		// We disable this to prevent pb of modules not correctly disabled
		//$this->remove($options);

		require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
		$dirodt=DOL_DATA_ROOT.'/doctemplates/thirdparties';
		create_exdir($dirodt);
		dol_copy(DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt',$dirodt.'/template_thirdparty.odt',0,0);

		$sql = array();

		return $this->_init($sql,$options);
	}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:22,代码来源:modSociete.class.php


注:本文中的create_exdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。