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


PHP dol_string_nospecial函数代码示例

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


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

示例1: show_day_events2

/**
 * Show event of a particular day for a user
 *
 * @param	string	$username		Login
 * @param   int		$day            Day
 * @param   int		$month          Month
 * @param   int		$year           Year
 * @param   int		$monthshown     Current month shown in calendar view
 * @param   string	$style          Style to use for this day
 * @param   array	$eventarray    	Array of events
 * @param   int		$maxprint       Nb of actions to show each day on month view (0 means no limit)
 * @param   int		$maxnbofchar    Nb of characters to show for event line
 * @param   string	$newparam       Parameters on current URL
 * @param   int		$showinfo       Add extended information (used by day view)
 * @param   int		$minheight      Minimum height for each event. 60px by default.
 * @param	boolean	$showheader		Show header
 * @param	array	$colorsbytype	Array with colors by type
 * @param	bool	$var			true or false for alternat style on tr/td
 * @return	void
 */
function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $showheader = false, $colorsbytype = array(), $var = false)
{
    global $db;
    global $user, $conf, $langs, $hookmanager, $action;
    global $filter, $filtert, $status, $actioncode;
    // Filters used into search form
    global $theme_datacolor;
    // Array with a list of different we can use (come from theme)
    global $cachethirdparties, $cachecontacts, $colorindexused;
    global $begin_h, $end_h;
    $cases1 = array();
    // Color first half hour
    $cases2 = array();
    // Color second half hour
    $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
    $i = 0;
    $nummytasks = 0;
    $numother = 0;
    $numbirthday = 0;
    $numical = 0;
    $numicals = array();
    $ymd = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
    $nextindextouse = count($colorindexused);
    // At first run, this is 0, so fist user has 0, next 1, ...
    //if ($username->id && $day==1) var_dump($eventarray);
    // We are in a particular day for $username, now we scan all events
    foreach ($eventarray as $daykey => $notused) {
        $annee = date('Y', $daykey);
        $mois = date('m', $daykey);
        $jour = date('d', $daykey);
        //print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."<br>\n";
        if ($day == $jour && $month == $mois && $year == $annee) {
            // Scan all event for this date
            foreach ($eventarray[$daykey] as $index => $event) {
                $keysofuserassigned = array_keys($event->userassigned);
                if (!in_array($username->id, $keysofuserassigned)) {
                    continue;
                }
                // We discard record if event is from another user than user we want to show
                //if ($username->id != $event->userownerid) continue;	// We discard record if event is from another user than user we want to show
                $parameters = array();
                $reshook = $hookmanager->executeHooks('formatEvent', $parameters, $event, $action);
                // Note that $action and $object may have been modified by some hooks
                if ($reshook < 0) {
                    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
                }
                $ponct = $event->date_start_in_calendar == $event->date_end_in_calendar;
                // Define $color (Hex string like '0088FF') and $cssclass of event
                $color = -1;
                $cssclass = '';
                $colorindex = -1;
                if (in_array($user->id, $keysofuserassigned)) {
                    $nummytasks++;
                    $cssclass = 'family_mytasks';
                    if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
                        $color = $event->type_color;
                    }
                } else {
                    if ($event->type_code == 'ICALEVENT') {
                        $numical++;
                        if (!empty($event->icalname)) {
                            if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
                                $numicals[dol_string_nospecial($event->icalname)] = 0;
                            }
                            $numicals[dol_string_nospecial($event->icalname)]++;
                        }
                        $color = $event->icalcolor;
                        $cssclass = !empty($event->icalname) ? 'family_ext' . md5($event->icalname) : 'family_other unsortable';
                    } else {
                        if ($event->type_code == 'BIRTHDAY') {
                            $numbirthday++;
                            $colorindex = 2;
                            $cssclass = 'family_birthday unsortable';
                            $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
                        } else {
                            $numother++;
                            $cssclass = 'family_other';
                            if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
                                $color = $event->type_color;
                            }
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:peruser.php

示例2: draw_jflot

    /**
     * Build a graph onto disk using JFlot library. Input when calling this method should be:
     *	$this->data  = array(array(      0=>'labelxA',     1=>yA),  array('labelxB',yB)); or
     *  $this->data  = array(array('label'=>'labelxA','data'=>yA),  array('labelxB',yB));			// TODO Syntax not supported. Removed when dol_print_graph_removed
     *	$this->data  = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn));   // when there is n series to show for each x
     *  $this->legend= array("Val1",...,"Valn");													// list of n series name
     *  $this->type  = array('bars',...'lines'); or array('pie')
     *  $this->mode = 'depth' ???
     *  $this->bgcolorgrid
     *  $this->datacolor
     *
     * @param	string	$file    	Image file name to use to save onto disk (also used as javascript unique id)
     * @param	string	$fileurl	Url path to show image if saved onto disk
     * @return	void
     */
    private function draw_jflot($file, $fileurl)
    {
        global $artichow_defaultfont;
        dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type));
        if (empty($this->width) && empty($this->height)) {
            print 'Error width or height not set';
            return;
        }
        $legends = array();
        $nblot = count($this->data[0]) - 1;
        // -1 to remove legend
        if ($nblot < 0) {
            dol_print_error('Bad value for property ->data. Must be set by mydolgraph->SetData before callinf mydolgrapgh->draw');
        }
        $firstlot = 0;
        // Works with line but not with bars
        //if ($nblot > 2) $firstlot = ($nblot - 2);        // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
        $i = $firstlot;
        $serie = array();
        while ($i < $nblot) {
            $values = array();
            // Array with horizontal y values (specific values of a serie) for each abscisse x
            $serie[$i] = "var d" . $i . " = [];\n";
            // Fill array $values
            $x = 0;
            foreach ($this->data as $valarray) {
                $legends[$x] = $valarray[0];
                $values[$x] = is_numeric($valarray[$i + 1]) ? $valarray[$i + 1] : null;
                $x++;
            }
            // TODO Avoid push by adding generated long array...
            if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') {
                foreach ($values as $x => $y) {
                    if (isset($y)) {
                        $serie[$i] .= 'd' . $i . '.push({"label":"' . dol_escape_js($legends[$x]) . '", "data":' . $y . '});' . "\n";
                    }
                }
            } else {
                foreach ($values as $x => $y) {
                    if (isset($y)) {
                        $serie[$i] .= 'd' . $i . '.push([' . $x . ', ' . $y . ']);' . "\n";
                    }
                }
            }
            unset($values);
            $i++;
        }
        $tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
        $this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n";
        if (!empty($this->title)) {
            $this->_stringtoshow .= '<div align="center" class="dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
        }
        $this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="dolgraph' . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . '"></div>' . "\n";
        $this->_stringtoshow .= '<script id="' . $tag . '">' . "\n";
        $this->_stringtoshow .= '$(function () {' . "\n";
        $i = $firstlot;
        while ($i < $nblot) {
            $this->_stringtoshow .= $serie[$i];
            $i++;
        }
        $this->_stringtoshow .= "\n";
        // Special case for Graph of type 'pie'
        if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie') {
            $datacolor = array();
            foreach ($this->datacolor as $val) {
                $datacolor[] = "#" . sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]);
            }
            $urltemp = '';
            // TODO Add support for url link into labels
            $showlegend = $this->showlegend;
            $showpointvalue = $this->showpointvalue;
            $showpercent = $this->showpercent;
            $this->_stringtoshow .= '
			function plotWithOptions_' . $tag . '() {
			$.plot($("#placeholder_' . $tag . '"), d0,
			{
			series: {
			pie: {
			show: true,
			radius: 3/4,
			label: {
			show: true,
			radius: 3/4,
			formatter: function(label, series) {
			var percent=Math.round(series.percent);
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:dolgraph.class.php

示例3: dol_buildlogin

/**
 *  Build a login from lastname, firstname
 *
 *  @param	string		$lastname		Lastname
 *  @param  string		$firstname		Firstname
 *	@return	string						Login
 */
function dol_buildlogin($lastname, $firstname)
{
    $login = strtolower(dol_string_unaccent($firstname));
    $login .= $login ? '.' : '';
    $login .= strtolower(dol_string_unaccent($lastname));
    $login = dol_string_nospecial($login, '');
    // For special names
    return $login;
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:16,代码来源:functions2.lib.php

示例4: show_day_events

/**
 * Show event of a particular day
 *
 * @param	DoliDB	$db              Database handler
 * @param   int		$day             Day
 * @param   int		$month           Month
 * @param   int		$year            Year
 * @param   int		$monthshown      Current month shown in calendar view
 * @param   string	$style           Style to use for this day
 * @param   array	$eventarray      Array of events
 * @param   int		$maxprint        Nb of actions to show each day on month view (0 means no limit)
 * @param   int		$maxnbofchar     Nb of characters to show for event line
 * @param   string	$newparam        Parameters on current URL
 * @param   int		$showinfo        Add extended information (used by day and week view)
 * @param   int		$minheight       Minimum height for each event. 60px by default.
 * @return	void
 */
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60)
{
    global $user, $conf, $langs;
    global $action, $filter, $filtert, $status, $actioncode;
    // Filters used into search form
    global $theme_datacolor;
    global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
    print "\n" . '<div id="dayevent_' . sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day) . '" class="dayevent">';
    // Line with title of day
    $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
    print '<table class="nobordernopadding" width="100%">' . "\n";
    print '<tr><td align="left" class="nowrap">';
    print '<a href="' . DOL_URL_ROOT . '/comm/action/index.php?';
    print 'action=show_day&day=' . str_pad($day, 2, "0", STR_PAD_LEFT) . '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year;
    print $newparam;
    print '">';
    if ($showinfo) {
        print dol_print_date($curtime, 'daytextshort');
    } else {
        print dol_print_date($curtime, '%d');
    }
    print '</a>';
    print '</td><td align="right" class="nowrap">';
    if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
        $newparam .= '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year;
        //$param='month='.$monthshown.'&year='.$year;
        $hourminsec = '100000';
        print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&datep=' . sprintf("%04d%02d%02d", $year, $month, $day) . $hourminsec . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . ($newparam ? '?' . $newparam : '')) . '">';
        print img_picto($langs->trans("NewAction"), 'edit_add.png');
        print '</a>';
    }
    print '</td></tr>' . "\n";
    // Line with td contains all div of each events
    print '<tr height="' . $minheight . '"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
    print '<div style="width: 100%; position: relative;">';
    //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
    $i = 0;
    $nummytasks = 0;
    $numother = 0;
    $numbirthday = 0;
    $numical = 0;
    $numicals = array();
    $ymd = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
    $nextindextouse = count($colorindexused);
    // At first run this is 0, so fist user has 0, next 1, ...
    //print $nextindextouse;
    foreach ($eventarray as $daykey => $notused) {
        $annee = date('Y', $daykey);
        $mois = date('m', $daykey);
        $jour = date('d', $daykey);
        if ($day == $jour && $month == $mois && $year == $annee) {
            foreach ($eventarray[$daykey] as $index => $event) {
                if ($i < $maxprint || $maxprint == 0 || !empty($conf->global->MAIN_JS_SWITCH_AGENDA)) {
                    $keysofuserassigned = array_keys($event->userassigned);
                    $ponct = $event->date_start_in_calendar == $event->date_end_in_calendar;
                    // Define $color (Hex string like '0088FF') and $cssclass of event
                    $color = -1;
                    $colorindex = -1;
                    if (in_array($user->id, $keysofuserassigned)) {
                        $nummytasks++;
                        $cssclass = 'family_mytasks';
                        if (empty($cacheusers[$event->userownerid])) {
                            $newuser = new User($db);
                            $newuser->fetch($event->userownerid);
                            $cacheusers[$event->userownerid] = $newuser;
                        }
                        //var_dump($cacheusers[$event->userownerid]->color);
                        // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
                        if (!empty($cacheusers[$event->userownerid]->color)) {
                            $color = $cacheusers[$event->userownerid]->color;
                        }
                    } else {
                        if ($event->type_code == 'ICALEVENT') {
                            $numical++;
                            if (!empty($event->icalname)) {
                                if (!isset($numicals[dol_string_nospecial($event->icalname)])) {
                                    $numicals[dol_string_nospecial($event->icalname)] = 0;
                                }
                                $numicals[dol_string_nospecial($event->icalname)]++;
                            }
                            $color = $event->icalcolor;
                            $cssclass = !empty($event->icalname) ? 'family_ext' . md5($event->icalname) : 'family_other';
                        } else {
//.........这里部分代码省略.........
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:index.php

示例5: update

 /**
  *	Update a record into database
  *
  *	@param	int		$id         Id of product
  *	@param  User	$user       Object user making update
  *	@param	int		$notrigger	Disable triggers
  *	@param	string	$action		Current action for hookmanager ('add' or 'update')
  *	@return int         		1 if OK, -1 if ref already exists, -2 if other error
  */
 function update($id, $user, $notrigger = false, $action = 'update')
 {
     global $langs, $conf, $hookmanager;
     $error = 0;
     // Check parameters
     if (!$this->label) {
         $this->label = 'MISSING LABEL';
     }
     // Clean parameters
     $this->ref = dol_string_nospecial(trim($this->ref));
     $this->label = trim($this->label);
     $this->description = trim($this->description);
     $this->note = isset($this->note) ? trim($this->note) : null;
     $this->weight = price2num($this->weight);
     $this->weight_units = trim($this->weight_units);
     $this->length = price2num($this->length);
     $this->length_units = trim($this->length_units);
     $this->surface = price2num($this->surface);
     $this->surface_units = trim($this->surface_units);
     $this->volume = price2num($this->volume);
     $this->volume_units = trim($this->volume_units);
     if (empty($this->tva_tx)) {
         $this->tva_tx = 0;
     }
     if (empty($this->tva_npr)) {
         $this->tva_npr = 0;
     }
     if (empty($this->localtax1_tx)) {
         $this->localtax1_tx = 0;
     }
     if (empty($this->localtax2_tx)) {
         $this->localtax2_tx = 0;
     }
     if (empty($this->status)) {
         $this->status = 0;
     }
     if (empty($this->status_buy)) {
         $this->status_buy = 0;
     }
     if (empty($this->country_id)) {
         $this->country_id = 0;
     }
     // Barcode value
     $this->barcode = trim($this->barcode);
     $this->accountancy_code_buy = trim($this->accountancy_code_buy);
     $this->accountancy_code_sell = trim($this->accountancy_code_sell);
     $this->db->begin();
     // Check name is required and codes are ok or unique.
     // If error, this->errors[] is filled
     if ($action != 'add') {
         $result = $this->verify();
         // We don't check when update called during a create because verify was already done
     }
     if ($result >= 0) {
         if (empty($this->oldcopy)) {
             $org = new self($this->db);
             $org->fetch($this->id);
             $this->oldcopy = $org;
         }
         // test if batch management is activated on existing product
         if ($this->hasbatch() && !$this->oldcopy->hasbatch()) {
             $this->load_stock();
             foreach ($this->stock_warehouse as $idW => $ObjW) {
                 $qty_batch = 0;
                 foreach ($ObjW->detail_batch as $detail) {
                     $qty_batch += $detail->qty;
                 }
                 // Quantities in batch details are not same same as stock quantity
                 // So we add a default batch record
                 if ($ObjW->real != $qty_batch) {
                     $ObjBatch = new Productbatch($this->db);
                     $ObjBatch->batch = $langs->trans('BatchDefaultNumber');
                     $ObjBatch->qty = $ObjW->real - $qty_batch;
                     $ObjBatch->fk_product_stock = $ObjW->id;
                     if ($ObjBatch->create($user, 1) < 0) {
                         $error++;
                         $this->errors = $ObjBatch->errors;
                     }
                 }
             }
         }
         // For automatic creation
         if ($this->barcode == -1) {
             $this->barcode = $this->get_barcode($this, $this->barcode_type_code);
         }
         $sql = "UPDATE " . MAIN_DB_PREFIX . "product";
         $sql .= " SET label = '" . $this->db->escape($this->label) . "'";
         $sql .= ", ref = '" . $this->db->escape($this->ref) . "'";
         $sql .= ", ref_ext = " . (!empty($this->ref_ext) ? "'" . $this->db->escape($this->ref_ext) . "'" : "null");
         $sql .= ", tva_tx = " . $this->tva_tx;
         $sql .= ", recuperableonly = " . $this->tva_npr;
//.........这里部分代码省略.........
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:101,代码来源:product.class.php

示例6: show_day_events

/**
 * Show event of a particular day
 *
 * @param	DoliDB	$db              Database handler
 * @param   int		$day             Day
 * @param   int		$month           Month
 * @param   int		$year            Year
 * @param   int		$monthshown      Current month shown in calendar view
 * @param   string	$style           Style to use for this day
 * @param   array	&$eventarray     Array of events
 * @param   int		$maxprint        Nb of actions to show each day on month view (0 means no limit)
 * @param   int		$maxnbofchar     Nb of characters to show for event line
 * @param   string	$newparam        Parameters on current URL
 * @param   int		$showinfo        Add extended information (used by day view)
 * @param   int		$minheight       Minimum height for each event. 60px by default.
 * @return	void
 */
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60)
{
    global $user, $conf, $langs;
    global $filter, $filtera, $filtert, $filterd, $status;
    global $theme_datacolor;
    global $cachethirdparties, $cachecontacts;
    print '<div id="dayevent_' . sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day) . '" class="dayevent">' . "\n";
    $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
    print '<table class="nobordernopadding" width="100%">';
    print '<tr style="background: #EEEEEE"><td align="left" nowrap="nowrap">';
    print '<a href="' . DOL_URL_ROOT . '/comm/action/index.php?';
    print 'action=show_day&day=' . str_pad($day, 2, "0", STR_PAD_LEFT) . '&month=' . str_pad($month, 2, "0", STR_PAD_LEFT) . '&year=' . $year;
    print $newparam;
    //.'&month='.$month.'&year='.$year;
    print '">';
    if ($showinfo) {
        print dol_print_date($curtime, 'daytext');
    } else {
        print dol_print_date($curtime, '%d');
    }
    print '</a>';
    print '</td><td align="right" nowrap="nowrap">';
    if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
        //$param='month='.$monthshown.'&year='.$year;
        $hourminsec = '100000';
        print '<a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&datep=' . sprintf("%04d%02d%02d", $year, $month, $day) . $hourminsec . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . ($newparam ? '?' . $newparam : '')) . '">';
        print img_picto($langs->trans("NewAction"), 'edit_add.png');
        print '</a>';
    }
    print '</td></tr>';
    print '<tr height="' . $minheight . '"><td valign="top" colspan="2" nowrap="nowrap">';
    //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
    $i = 0;
    $nummytasks = 0;
    $numother = 0;
    $numbirthday = 0;
    $numical = 0;
    $numicals = array();
    $ymd = sprintf("%04d", $year) . sprintf("%02d", $month) . sprintf("%02d", $day);
    foreach ($eventarray as $daykey => $notused) {
        $annee = date('Y', $daykey);
        $mois = date('m', $daykey);
        $jour = date('d', $daykey);
        if ($day == $jour && $month == $mois && $year == $annee) {
            foreach ($eventarray[$daykey] as $index => $event) {
                if ($i < $maxprint || $maxprint == 0 || !empty($conf->global->MAIN_JS_SWITCH_AGENDA)) {
                    $ponct = $event->date_start_in_calendar == $event->date_end_in_calendar;
                    // Define $color and $cssclass of event
                    $color = -1;
                    $cssclass = '';
                    $colorindex = -1;
                    if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) {
                        $nummytasks++;
                        $colorindex = 1;
                        $cssclass = 'family_mytasks';
                    } else {
                        if ($event->type_code == 'ICALEVENT') {
                            $numical++;
                            $numicals[dol_string_nospecial($event->icalname)]++;
                            $color = $event->icalcolor;
                            $cssclass = $event->icalname ? 'family_' . dol_string_nospecial($event->icalname) : 'family_other';
                        } else {
                            if ($event->type_code == 'BIRTHDAY') {
                                $numbirthday++;
                                $colorindex = 2;
                                $cssclass = 'family_birthday';
                            } else {
                                $numother++;
                                $colorindex = 2;
                                $cssclass = 'family_other';
                            }
                        }
                    }
                    if ($color == -1) {
                        $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
                    }
                    $cssclass = $cssclass . ' ' . $cssclass . '_day_' . $ymd;
                    // Show rect of event
                    print '<div id="event_' . $ymd . '_' . $i . '" class="event ' . $cssclass . '">';
                    print '<table class="cal_event" style="background: #' . $color . '; -moz-border-radius:4px;" width="100%"><tr>';
                    print '<td nowrap="nowrap">';
                    if ($event->type_code == 'BIRTHDAY') {
                        print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:index.php

示例7: setEventMessages

        if ($id > 0) {
            $_GET["id"] = $id;
            // Force chargement page en mode visu
        } else {
            setEventMessages($account->error, $account->errors, 'errors');
            $action = 'create';
            // Force chargement page en mode creation
        }
    }
}
if ($_POST["action"] == 'update' && !$_POST["cancel"]) {
    $error = 0;
    // Update account
    $account = new Account($db);
    $account->fetch($_POST["id"]);
    $account->ref = dol_string_nospecial(trim($_POST["ref"]));
    $account->label = trim($_POST["label"]);
    $account->courant = $_POST["type"];
    $account->clos = $_POST["clos"];
    $account->rappro = isset($_POST["norappro"]) && $_POST["norappro"] ? 0 : 1;
    $account->url = trim($_POST["url"]);
    $account->bank = trim($_POST["bank"]);
    $account->code_banque = trim($_POST["code_banque"]);
    $account->code_guichet = trim($_POST["code_guichet"]);
    $account->number = trim($_POST["number"]);
    $account->cle_rib = trim($_POST["cle_rib"]);
    $account->bic = trim($_POST["bic"]);
    $account->iban = trim($_POST["iban"]);
    $account->domiciliation = trim($_POST["domiciliation"]);
    $account->proprio = trim($_POST["proprio"]);
    $account->owner_address = trim($_POST["owner_address"]);
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:card.php

示例8: update

	/**
	 *	Update a record into database
	 *
	 *	@param	int		$id         Id of product
	 *	@param  User	$user       Object user making update
	 *	@param	int		$notrigger	Disable triggers
	 *	@return int         		1 if OK, -1 if ref already exists, -2 if other error
	 */
	function update($id, $user, $notrigger=false)
	{
		global $langs, $conf;

		$error=0;

		$this->db->begin();

		// Verification parametres
		if (! $this->libelle) $this->libelle = 'MISSING LABEL';

		// Clean parameters
		$this->ref = dol_string_nospecial(trim($this->ref));
		$this->libelle = trim($this->libelle);
		$this->description = trim($this->description);
		$this->note = trim($this->note);
		$this->weight = price2num($this->weight);
		$this->weight_units = trim($this->weight_units);
		$this->length = price2num($this->length);
		$this->length_units = trim($this->length_units);
		$this->surface = price2num($this->surface);
		$this->surface_units = trim($this->surface_units);
		$this->volume = price2num($this->volume);
		$this->volume_units = trim($this->volume_units);
		if (empty($this->tva_tx))    			$this->tva_tx = 0;
		if (empty($this->tva_npr))    			$this->tva_npr = 0;
		//Local taxes
		if (empty($this->localtax1_tx))			$this->localtax1_tx = 0;
		if (empty($this->localtax2_tx))			$this->localtax2_tx = 0;

		if (empty($this->finished))  			$this->finished = 0;
        if (empty($this->country_id))           $this->country_id = 0;

		$this->accountancy_code_buy = trim($this->accountancy_code_buy);
		$this->accountancy_code_sell= trim($this->accountancy_code_sell);

		$sql = "UPDATE ".MAIN_DB_PREFIX."product";
		$sql.= " SET label = '" . $this->db->escape($this->libelle) ."'";
		$sql.= ",ref = '" . $this->ref ."'";
		$sql.= ",tva_tx = " . $this->tva_tx;
		$sql.= ",recuperableonly = " . $this->tva_npr;

		//Local taxes
		$sql.= ",localtax1_tx = " . $this->localtax1_tx;
		$sql.= ",localtax2_tx = " . $this->localtax2_tx;

		$sql.= ",tosell = " . $this->status;
		$sql.= ",tobuy = " . $this->status_buy;
		$sql.= ",finished = " . ($this->finished<0 ? "null" : $this->finished);
		$sql.= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
		$sql.= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
		$sql.= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
		$sql.= ",length_units = " . ($this->length_units!='' ? "'".$this->length_units."'" : 'null');
		$sql.= ",surface = " . ($this->surface!='' ? "'".$this->surface."'" : 'null');
		$sql.= ",surface_units = " . ($this->surface_units!='' ? "'".$this->surface_units."'" : 'null');
		$sql.= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
		$sql.= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
		$sql.= ",seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null");
		$sql.= ",description = '" . $this->db->escape($this->description) ."'";
        $sql.= ",customcode = '" .        $this->db->escape($this->customcode) ."'";
        $sql.= ",fk_country = " . ($this->country_id > 0 ? $this->country_id : 'null');
        $sql.= ",note = '" .        $this->db->escape($this->note) ."'";
		$sql.= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
		$sql.= ",accountancy_code_buy = '" . $this->accountancy_code_buy."'";
		$sql.= ",accountancy_code_sell= '" . $this->accountancy_code_sell."'";
		$sql.= " WHERE rowid = " . $id;

		dol_syslog(get_class($this)."update sql=".$sql);
		$resql=$this->db->query($sql);
		if ($resql)
		{
			$this->id = $id;

			// Multilangs
			if($conf->global->MAIN_MULTILANGS)
			{
				if ( $this->setMultiLangs() < 0)
				{
					$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
					return -2;
				}
			}

			// Actions on extra fields (by external module or standard code)
			include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
			$hookmanager=new HookManager($this->db);
			$hookmanager->initHooks(array('productdao'));
			$parameters=array('id'=>$this->id);
			$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
			if (empty($reshook))
			{
			    $result=$this->insertExtraFields();
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:product.class.php

示例9: draw_jflot

    /**
     * Build a graph onto disk using JFlot library
     *	$graph_data = array(array('labelxA',yA),array('labelxB',yB));
     *	$graph_data = array(array('labelxA',yA1,...,yAn),array('labelxB',yB1,...yBn));	// when there is n value to show for each x
     *   $legend     = array("Val1",...,"Valn");											// list of n series name
     *
     * @param	string	$file    	Image file name to use if we save onto disk
     * @param	string	$fileurl	Url path to show image if saved onto disk
     * @return	void
     */
    private function draw_jflot($file, $fileurl)
    {
        global $artichow_defaultfont;
        dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type));
        // On boucle sur chaque lot de donnees
        $legends = array();
        $nblot = count($this->data[0]) - 1;
        // -1 to remove legend
        $firstlot = 0;
        if ($nblot > 2) {
            $firstlot = $nblot - 2;
        }
        // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
        $i = $firstlot;
        $serie = array();
        while ($i < $nblot) {
            $x = 0;
            $values = array();
            foreach ($this->data as $key => $valarray) {
                $legends[$x] = $valarray[0];
                $values[$x] = $valarray[$i + 1];
                $x++;
            }
            // We fix unknown values to null
            $newvalues = array();
            foreach ($values as $val) {
                $newvalues[] = is_numeric($val) ? $val : null;
            }
            //print "Lot de donnees $i<br>";
            //print_r($values);
            //print '<br>';
            $serie[$i] = "var d" . $i . " = [];\n";
            $x = 0;
            foreach ($newvalues as $key => $val) {
                if (isset($val)) {
                    $serie[$i] .= "d" . $i . ".push([" . $x . ", " . $val . "]);\n";
                }
                $x++;
            }
            $i++;
        }
        $tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
        $this->_stringtoshow = '<!-- Build using ' . $this->_library . ' -->' . "\n";
        $this->_stringtoshow .= '<br><div align="center">' . $this->title . '</div><br>';
        $this->_stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;"></div>' . "\n";
        $this->_stringtoshow .= '<script id="' . $tag . '">' . "\n";
        $this->_stringtoshow .= '$(function () {' . "\n";
        $i = $firstlot;
        while ($i < $nblot) {
            $this->_stringtoshow .= $serie[$i];
            $i++;
        }
        $this->_stringtoshow .= "\n";
        $this->_stringtoshow .= '
        function showTooltip_' . $tag . '(x, y, contents) {
            $(\'<div id="tooltip_' . $tag . '">\' + contents + \'</div>\').css( {
                position: \'absolute\',
                display: \'none\',
                top: y + 5,
                left: x + 5,
                border: \'1px solid #ddd\',
                padding: \'2px\',
                \'background-color\': \'#ffe\',
                width: 200,
                opacity: 0.80
            }).appendTo("body").fadeIn(20);
        }

        var previousPoint = null;
    	$("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) {
        $("#x").text(pos.x.toFixed(2));
        $("#y").text(pos.y.toFixed(2));

        if (item) {
            if (previousPoint != item.dataIndex) {
                previousPoint = item.dataIndex;

                $("#tooltip").remove();
                /* console.log(item); */
                var x = item.datapoint[0].toFixed(2);
                var y = item.datapoint[1].toFixed(2);
                var z = item.series.xaxis.ticks[item.dataIndex].label;

                showTooltip_' . $tag . '(item.pageX, item.pageY,
                            item.series.label + "<br>" + z + " => " + y);
            }
        }
        else {
            $("#tooltip_' . $tag . '").remove();
            previousPoint = null;
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:dolgraph.class.php

示例10: dol_sanitizeFileName

/**
 *	Clean a string to use it as a file name.
 *	@param          str             String to clean
 * 	@param			newstr			String to replace bad chars with
 *	@return         string          String cleaned (a-zA-Z_)
 * 	@see        	dol_string_nospecial, dol_string_unaccent
 */
function dol_sanitizeFileName($str, $newstr = '_')
{
    global $conf;
    return dol_string_nospecial(dol_string_unaccent($str), $newstr, $conf->filesystem_forbidden_chars);
}
开发者ID:netors,项目名称:dolibarr,代码行数:12,代码来源:functions.lib.php

示例11: update

	/**
	 *	Update a record into database
	 *	@param      id          Id of product
	 *	@param      user        Object user making update
	 *	@return     int         1 if OK, -1 if ref already exists, -2 if other error
	 */
	function update($id, $user)
	{
		global $langs, $conf;

		// Verification parametres
		if (! $this->libelle) $this->libelle = 'LIBELLE MANQUANT';

		// Clean parameters
		$this->ref = dol_string_nospecial(trim($this->ref));
		$this->libelle = trim($this->libelle);
		$this->description = trim($this->description);
		$this->note = trim($this->note);
		$this->weight = price2num($this->weight);
		$this->weight_units = trim($this->weight_units);
		$this->length = price2num($this->length);
		$this->length_units = trim($this->length_units);
		$this->surface = price2num($this->surface);
		$this->surface_units = trim($this->surface_units);
		$this->volume = price2num($this->volume);
		$this->volume_units = trim($this->volume_units);
		if (empty($this->tva_tx))    			$this->tva_tx = 0;
		if (empty($this->tva_npr))    			$this->tva_npr = 0;
		//Local taxes
		if (empty($this->localtax1_tx))			$this->localtax1_tx = 0;
		if (empty($this->localtax2_tx))			$this->localtax2_tx = 0;

		if (empty($this->finished))  			$this->finished = 0;
		if (empty($this->hidden))   			$this->hidden = 0;
        if (empty($this->country_id))           $this->country_id = 0;

		$this->accountancy_code_buy = trim($this->accountancy_code_buy);
		$this->accountancy_code_sell= trim($this->accountancy_code_sell);

		$sql = "UPDATE ".MAIN_DB_PREFIX."product";
		$sql.= " SET label = '" . $this->db->escape($this->libelle) ."'";
		$sql.= ",ref = '" . $this->ref ."'";
		$sql.= ",tva_tx = " . $this->tva_tx;
		$sql.= ",recuperableonly = " . $this->tva_npr;

		//Local taxes
		$sql.= ",localtax1_tx = " . $this->localtax1_tx;
		$sql.= ",localtax2_tx = " . $this->localtax2_tx;

		$sql.= ",tosell = " . $this->status;
		$sql.= ",tobuy = " . $this->status_buy;
		$sql.= ",finished = " . ($this->finished<0 ? "null" : $this->finished);
		$sql.= ",hidden = " . ($this->hidden<0 ? "null" : $this->hidden);
		$sql.= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
		$sql.= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
		$sql.= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
		$sql.= ",length_units = " . ($this->length_units!='' ? "'".$this->length_units."'" : 'null');
		$sql.= ",surface = " . ($this->surface!='' ? "'".$this->surface."'" : 'null');
		$sql.= ",surface_units = " . ($this->surface_units!='' ? "'".$this->surface_units."'" : 'null');
		$sql.= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
		$sql.= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
		$sql.= ",seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null");
		$sql.= ",description = '" . $this->db->escape($this->description) ."'";
        $sql.= ",customcode = '" .        $this->db->escape($this->customcode) ."'";
        $sql.= ",fk_country = " . ($this->country_id > 0 ? $this->country_id : 'null');
        $sql.= ",note = '" .        $this->db->escape($this->note) ."'";
		$sql.= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
		$sql.= ",accountancy_code_buy = '" . $this->accountancy_code_buy."'";
		$sql.= ",accountancy_code_sell= '" . $this->accountancy_code_sell."'";
		$sql.= " WHERE rowid = " . $id;

		dol_syslog("Product::update sql=".$sql);
		$resql=$this->db->query($sql);
		if ($resql)
		{
			$this->id = $id;

			// Multilangs
			if($conf->global->MAIN_MULTILANGS)
			{
				if ( $this->setMultiLangs() < 0)
				{
					$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
					return -2;
				}
			}

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

			return 1;
		}
		else
		{
			if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
			{
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:product.class.php

示例12: lineMapper_IMMECA

function lineMapper_IMMECA($line)
{
    if (empty($line[2])) {
        return false;
    }
    // Si label vide
    $Tab = array('label' => $line[2], 'qty' => $line[3], 'type' => 'line', 'product_ref' => dol_string_nospecial($line[1]), 'level' => 0, 'price' => $line[4]);
    return $Tab;
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_importdevis,代码行数:9,代码来源:importdevis.lib.php

示例13: print_actions_filter

/**
 * Show filter form in agenda view
 *
 * @param	Object	$form			Form object
 * @param	int		$canedit		Can edit filter fields
 * @param	int		$status			Status
 * @param 	int		$year			Year
 * @param 	int		$month			Month
 * @param 	int		$day			Day
 * @param 	int		$showbirthday	Show birthday
 * @param 	string	$filtera		Filter on create by user
 * @param 	string	$filtert		Filter on assigned to user
 * @param 	string	$filterd		Filter of done by user
 * @param 	int		$pid			Product id
 * @param 	int		$socid			Third party id
 * @param	array	$showextcals	Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
 * @param	string	$actioncode		Preselected value of actioncode for filter on type
 * @return	void
 */
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $showextcals = array(), $actioncode = '')
{
    global $conf, $user, $langs, $db;
    // Filters
    print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="status" value="' . $status . '">';
    print '<input type="hidden" name="year" value="' . $year . '">';
    print '<input type="hidden" name="month" value="' . $month . '">';
    print '<input type="hidden" name="day" value="' . $day . '">';
    print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
    print '<table class="nobordernopadding" width="100%">';
    print '<tr><td class="nowrap">';
    print '<table class="nobordernopadding">';
    if ($canedit) {
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("ActionsAskedBy");
        print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
        print $form->select_dolusers($filtera, 'userasked', 1, '', !$canedit);
        print '</td>';
        print '</tr>';
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy");
        print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
        print $form->select_dolusers($filtert, 'usertodo', 1, '', !$canedit);
        print '</td></tr>';
        /*print '<tr>';
        		print '<td class="nowrap">';
        		print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy");
        		print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
        		print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit);
        		print '</td></tr>';*/
        include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
        $formactions = new FormActions($db);
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("Type");
        print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
        print $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0);
        print '</td></tr>';
    }
    if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
        require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
        $formproject = new FormProjets($db);
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("Project") . ' &nbsp; ';
        print '</td><td class="nowrap maxwidthonsmartphone">';
        $formproject->select_projects($socid ? $socid : -1, $pid, 'projectid', 64);
        print '</td></tr>';
    }
    print '</table>';
    print '</td>';
    // Buttons
    print '<td align="center" valign="middle" class="nowrap">';
    print img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewcal" value="' . $langs->trans("ViewCal") . '">';
    print '<br>';
    print img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewweek" value="' . $langs->trans("ViewWeek") . '">';
    print '<br>';
    print img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewday" value="' . $langs->trans("ViewDay") . '">';
    print '<br>';
    print img_picto($langs->trans("ViewList"), 'object_list', 'class="hideonsmartphone"') . ' <input type="submit" class="button" style="min-width:120px" name="viewlist" value="' . $langs->trans("ViewList") . '">';
    print '</td>';
    // Legend
    if ($conf->use_javascript_ajax && is_array($showextcals)) {
        print '<td align="center" valign="middle" class="nowrap">';
        print '<script type="text/javascript">' . "\n";
        print 'jQuery(document).ready(function () {' . "\n";
        print 'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
        print 'jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
        print 'jQuery(".family_birthday").toggle();' . "\n";
        print '});' . "\n";
        print '</script>' . "\n";
        print '<table>';
        if (!empty($conf->use_javascript_ajax)) {
            if (count($showextcals) > 0) {
                print '<tr><td><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>';
                foreach ($showextcals as $val) {
                    $htmlname = dol_string_nospecial($val['name']);
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:agenda.lib.php

示例14: dol_sanitizeFileName

/**
 *	Clean a string to use it as a file name
 *
 *	@param	string	$str            String to clean
 * 	@param	string	$newstr			String to replace bad chars with
 *  @param	int	$unaccent		1=Remove also accent (default), 0 do not remove them
 *	@return string          		String cleaned (a-zA-Z_)
 *
 * 	@see        	dol_string_nospecial, dol_string_unaccent
 */
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
{
    $filesystem_forbidden_chars = array('<', '>', ':', '/', '\\', '?', '*', '|', '"');
    return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:15,代码来源:functions.lib.php

示例15: write_file

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param		Societe		$object				Object source to build document
  *	@param		Translate	$outputlangs		Lang output object
  * 	@param		string		$srctemplatepath	Full path of source filename for generator using a template file
  *  @param		int			$hidedetails		Do not show line details
  *  @param		int			$hidedesc			Do not show desc
  *  @param		int			$hideref			Do not show ref
  *	@return		int         					1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
 {
     global $user, $langs, $conf, $mysoc, $hookmanager;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     // Add odtgeneration hook
     if (!is_object($hookmanager)) {
         include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
         $hookmanager = new HookManager($this->db);
     }
     $hookmanager->initHooks(array('odtgeneration'));
     global $action;
     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->multidir_output[$object->entity]) {
         $dir = $conf->societe->multidir_output[$object->entity];
         $objectref = dol_sanitizeFileName($object->id);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         if (!file_exists($dir)) {
             if (dol_mkdir($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('/\\.od(s|t)/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             // Get extension (ods or odt)
             $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
             if (!empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME)) {
                 $newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)) . '-' . $newfiletmp;
             }
             if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
                 $format = $conf->global->MAIN_DOC_USE_TIMING;
                 if ($format == '1') {
                     $format = '%Y%m%d%H%M%S';
                 }
                 $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
             } else {
                 $filename = $newfiletmp . '.' . $newfileformat;
             }
             $file = $dir . '/' . $filename;
             $object->builddoc_filename = $filename;
             // For triggers
             //print "newfileformat=".$newfileformat;
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             //exit;
             dol_mkdir($conf->societe->multidir_temp[$object->entity]);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             try {
                 $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->societe->multidir_temp[$object->entity], 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             } catch (Exception $e) {
                 $this->error = $e->getMessage();
                 return -1;
             }
             //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)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         //print $key.' '.$value;exit;
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
//.........这里部分代码省略.........
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:doc_generic_odt.modules.php


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