31require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
43 public $element =
'websitepage';
48 public $table_element =
'website_page';
53 public $picto =
'file-code';
58 public $fk_element =
'fk_website_page';
63 protected $childtablesoncascade = array(
'categorie_website_page');
75 public $type_container;
98 public $allowed_in_frames;
101 public $grabbed_from;
108 public $fk_user_creat;
109 public $fk_user_modif;
114 public $author_alias;
132 const STATUS_DRAFT = 0;
133 const STATUS_VALIDATED = 1;
164 public $fields = array(
165 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'index' => 1,
'position' => 1,
'comment' =>
'Id'),
166 'pageurl' => array(
'type' =>
'varchar(16)',
'label' =>
'WEBSITE_PAGENAME',
'enabled' => 1,
'visible' => 1,
'notnull' => 1,
'index' => 1,
'position' => 10,
'searchall' => 1,
'comment' =>
'Ref/alias of page'),
167 'aliasalt' => array(
'type' =>
'varchar(255)',
'label' =>
'AliasAlt',
'enabled' => 1,
'visible' => 1,
'notnull' => 1,
'index' => 0,
'position' => 11,
'searchall' => 0,
'comment' =>
'Alias alternative of page'),
168 'type_container' => array(
'type' =>
'varchar(16)',
'label' =>
'Type',
'enabled' => 1,
'visible' => 1,
'notnull' => 1,
'index' => 0,
'position' => 12,
'comment' =>
'Type of container'),
169 'title' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'enabled' => 1,
'visible' => 1,
'position' => 30,
'searchall' => 1,
'help' =>
'UseTextBetween5And70Chars'),
170 'description' => array(
'type' =>
'varchar(255)',
'label' =>
'Description',
'enabled' => 1,
'visible' => 1,
'position' => 30,
'searchall' => 1),
171 'image' => array(
'type' =>
'varchar(255)',
'label' =>
'Image',
'enabled' => 1,
'visible' => 1,
'position' => 32,
'searchall' => 0,
'help' =>
'Relative path of media. Used if Type is "blogpost"'),
172 'keywords' => array(
'type' =>
'varchar(255)',
'label' =>
'Keywords',
'enabled' => 1,
'visible' => 1,
'position' => 45,
'searchall' => 0),
173 'lang' => array(
'type' =>
'varchar(6)',
'label' =>
'Lang',
'enabled' => 1,
'notnull' => -1,
'visible' => 1,
'position' => 45,
'searchall' => 0),
175 'fk_website' => array(
'type' =>
'integer',
'label' =>
'WebsiteId',
'enabled' => 1,
'visible' => 1,
'notnull' => 1,
'position' => 40,
'searchall' => 0,
'foreignkey' =>
'websitepage.rowid'),
176 'fk_page' => array(
'type' =>
'integer',
'label' =>
'ParentPageId',
'enabled' => 1,
'visible' => 1,
'notnull' => -1,
'position' => 45,
'searchall' => 0,
'foreignkey' =>
'website.rowid'),
177 'allowed_in_frames' => array(
'type' =>
'integer',
'label' =>
'AllowedInFrames',
'enabled' => 1,
'visible' => -1,
'position' => 48,
'searchall' => 0,
'default' =>
'0'),
178 'htmlheader' => array(
'type' =>
'html',
'label' =>
'HtmlHeader',
'enabled' => 1,
'visible' => 0,
'position' => 50,
'searchall' => 0),
179 'content' => array(
'type' =>
'mediumtext',
'label' =>
'Content',
'enabled' => 1,
'visible' => 0,
'position' => 51,
'searchall' => 0),
180 'grabbed_from' => array(
'type' =>
'varchar(255)',
'label' =>
'GrabbedFrom',
'enabled' => 1,
'visible' => 1,
'index' => 1,
'position' => 400,
'comment' =>
'URL page content was grabbed from'),
181 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 500),
182 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 501),
184 'fk_user_creat' => array(
'type' =>
'integer',
'label' =>
'UserAuthor',
'enabled' => 1,
'visible' => -1,
'notnull' =>
true,
'position' => 510),
185 'author_alias' => array(
'type' =>
'varchar(64)',
'label' =>
'AuthorAlias',
'enabled' => 1,
'visible' => -1,
'index' => 0,
'position' => 511,
'comment' =>
'Author alias'),
186 'fk_user_modif' => array(
'type' =>
'integer',
'label' =>
'UserModif',
'enabled' => 1,
'visible' => -1,
'position' => 512),
188 'import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -1,
'index' => 1,
'position' => 1000,
'notnull' => -1),
189 'object_type' => array(
'type' =>
'varchar(255)',
'label' =>
'ObjectType',
'enabled' => 1,
'visible' => 0,
'position' => 46,
'searchall' => 0,
'help' =>
''),
190 'fk_object' => array(
'type' =>
'varchar(255)',
'label' =>
'ObjectId',
'enabled' => 1,
'visible' => 0,
'position' => 47,
'searchall' => 0,
'help' =>
'')
215 $this->keywords =
dol_trunc($this->keywords, 255,
'right',
'utf-8', 1);
216 if ($this->aliasalt) {
217 $this->aliasalt =
','.preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $this->aliasalt)).
',';
220 $this->pageurl = preg_replace(
'/[^a-z0-9\-\_]/i',
'', $this->pageurl);
221 $this->pageurl = preg_replace(
'/\-\-+/',
'-', $this->pageurl);
222 $this->pageurl = preg_replace(
'/^\-/',
'', $this->pageurl);
225 $this->lang = preg_replace(
'/[_-].*$/',
'', trim($this->lang));
228 if (!$user->hasRight(
'website',
'writephp')) {
233 $this->error =
'Error: you try to create a page with PHP content without having permissions for that.';
234 $this->errors[] = $this->error;
253 public function fetch($id, $website_id =
null, $page =
null, $aliasalt =
null)
259 $sql .=
" t.fk_website,";
260 $sql .=
' t.type_container,';
261 $sql .=
" t.pageurl,";
262 $sql .=
" t.aliasalt,";
264 $sql .=
" t.description,";
266 $sql .=
" t.keywords,";
267 $sql .=
" t.htmlheader,";
268 $sql .=
" t.content,";
270 $sql .=
" t.fk_page,";
271 $sql .=
" t.allowed_in_frames,";
272 $sql .=
" t.status,";
273 $sql .=
" t.grabbed_from,";
274 $sql .=
" t.date_creation,";
275 $sql .=
" t.tms as date_modification,";
276 $sql .=
" t.fk_user_creat,";
277 $sql .=
" t.author_alias,";
278 $sql .=
" t.fk_user_modif,";
279 $sql .=
" t.import_key,";
280 $sql .=
" t.object_type,";
281 $sql .=
" t.fk_object";
282 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
284 $sql .=
' WHERE 1 = 1';
286 $sql .=
' AND t.rowid = '.((int) $id);
289 $sql .=
' AND t.rowid <> '.abs($id);
291 if (
null !== $website_id) {
292 $sql .=
" AND t.fk_website = '".$this->db->escape($website_id).
"'";
296 $tmppage = explode(
'/', $page);
297 if (!empty($tmppage[1])) {
298 $pagetouse = $tmppage[1];
299 if (strlen($tmppage[0])) {
300 $langtouse = $tmppage[0];
303 $sql .=
" AND t.pageurl = '".$this->db->escape($pagetouse).
"'";
305 $sql .=
" AND t.lang = '".$this->db->escape($langtouse).
"'";
309 $sql .=
" AND (t.aliasalt LIKE '%,".$this->db->escape($aliasalt).
",%' OR t.aliasalt LIKE '%, ".$this->db->escape($aliasalt).
",%')";
313 $sql .= $this->db->plimit(1);
315 $resql = $this->db->query($sql);
317 $numrows = $this->db->num_rows($resql);
319 $obj = $this->db->fetch_object($resql);
321 $this->
id = $obj->rowid;
323 $this->fk_website = $obj->fk_website;
324 $this->type_container = $obj->type_container;
326 $this->pageurl = $obj->pageurl;
327 $this->
ref = $obj->pageurl;
328 $this->aliasalt = preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $obj->aliasalt));
330 $this->title = $obj->title;
332 $this->image = $obj->image;
333 $this->keywords = $obj->keywords;
334 $this->htmlheader = $obj->htmlheader;
335 $this->content = $obj->content;
336 $this->lang = $obj->lang;
337 $this->fk_page = $obj->fk_page;
338 $this->allowed_in_frames = $obj->allowed_in_frames;
339 $this->
status = $obj->status;
340 $this->grabbed_from = $obj->grabbed_from;
341 $this->date_creation = $this->db->jdate($obj->date_creation);
342 $this->date_modification = $this->db->jdate($obj->date_modification);
343 $this->fk_user_creat = $obj->fk_user_creat;
344 $this->author_alias = $obj->author_alias;
345 $this->fk_user_modif = $obj->fk_user_modif;
346 $this->import_key = $obj->import_key;
347 $this->object_type = $obj->object_type;
348 $this->fk_object = $obj->fk_object;
350 $this->db->free($resql);
358 $this->errors[] =
'Error '.$this->db->lasterror();
359 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
378 public function fetchAll($websiteid =
'', $sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
386 $sql .=
" t.fk_website,";
387 $sql .=
" t.type_container,";
388 $sql .=
" t.pageurl,";
389 $sql .=
" t.aliasalt,";
391 $sql .=
" t.description,";
393 $sql .=
" t.keywords,";
394 $sql .=
" t.htmlheader,";
395 $sql .=
" t.content,";
397 $sql .=
" t.fk_page,";
398 $sql .=
" t.allowed_in_frames,";
399 $sql .=
" t.status,";
400 $sql .=
" t.grabbed_from,";
401 $sql .=
" t.date_creation,";
402 $sql .=
" t.tms as date_modification,";
403 $sql .=
" t.fk_user_creat,";
404 $sql .=
" t.author_alias,";
405 $sql .=
" t.fk_user_modif,";
406 $sql .=
" t.import_key,";
407 $sql .=
" t.object_type,";
408 $sql .=
" t.fk_object";
409 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
410 if (!empty($websiteid)) {
411 $sql .=
' WHERE t.fk_website = '.((int) $websiteid);
415 if (is_array($filter)) {
418 if (count($filter) > 0) {
419 foreach ($filter as $key => $value) {
420 if ($key ==
't.rowid' || $key ==
'rowid' || $key ==
't.fk_website' || $key ==
'fk_website' || $key ==
'status' || $key ==
't.status') {
421 $sqlwhere[] = $key.
" = ".((int) $value);
422 } elseif ($key ==
'type_container' || $key ==
't.type_container') {
423 $sqlwhere[] = $key.
" = '".$this->db->escape($value).
"'";
424 } elseif ($key ==
'lang' || $key ==
't.lang') {
425 $listoflang = array();
427 foreach (explode(
',', $value) as $tmpvalue) {
428 if ($tmpvalue ==
'null') {
432 $listoflang[] =
"'".$this->db->escape(substr(str_replace(
"'",
'', $tmpvalue), 0, 2)).
"'";
434 $stringtouse = $this->db->sanitize($key).
" IN (".$this->db->sanitize(implode(
',', $listoflang), 1).
")";
436 $stringtouse =
"(".$stringtouse.
" OR ".$this->db->sanitize($key).
" IS NULL)";
438 $sqlwhere[] = $stringtouse;
440 $sqlwhere[] = $this->db->sanitize($key).
" LIKE '%".$this->db->escape($value).
"%'";
444 if (count($sqlwhere) > 0) {
445 if (!empty($websiteid)) {
446 $sql .=
" AND (".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
448 $sql .=
" WHERE ".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere);
458 $this->errors[] = $errormessage;
459 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
463 if (!empty($sortfield)) {
464 $sql .= $this->db->order($sortfield, $sortorder);
466 if (!empty($limit)) {
467 $sql .= $this->db->plimit($limit, $offset);
470 $resql = $this->db->query($sql);
472 $num = $this->db->num_rows($resql);
474 while ($obj = $this->db->fetch_object($resql)) {
475 $record =
new self($this->db);
477 $record->id = $obj->rowid;
478 $record->fk_website = $obj->fk_website;
479 $record->type_container = $obj->type_container;
480 $record->pageurl = $obj->pageurl;
481 $record->aliasalt = preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $obj->aliasalt));
482 $record->title = $obj->title;
483 $record->description = $obj->description;
484 $record->image = $obj->image;
485 $record->keywords = $obj->keywords;
486 $record->htmlheader = $obj->htmlheader;
487 $record->content = $obj->content;
488 $record->lang = $obj->lang;
489 $record->fk_page = $obj->fk_page;
490 $record->allowed_in_frames = $obj->allowed_in_frames;
491 $record->status = $obj->status;
492 $record->grabbed_from = $obj->grabbed_from;
493 $record->date_creation = $this->db->jdate($obj->date_creation);
494 $record->date_modification = $this->db->jdate($obj->date_modification);
495 $record->fk_user_creat = $obj->fk_user_creat;
496 $record->author_alias = $obj->author_alias;
497 $record->fk_user_modif = $obj->fk_user_modif;
498 $record->import_key = $obj->import_key;
499 $record->object_type = $obj->object_type;
500 $record->fk_object = $obj->fk_object;
502 $records[$record->id] = $record;
504 $this->db->free($resql);
508 $this->error =
'Error '.$this->db->lasterror();
509 $this->errors[] = $this->error;
510 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
525 public function countAll($websiteid, $filter =
'', $filtermode =
'AND')
531 $sql =
'SELECT COUNT(t.rowid) as nb';
532 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
533 $sql .=
' WHERE t.fk_website = '.((int) $websiteid);
536 if (is_array($filter)) {
539 if (count($filter) > 0) {
540 foreach ($filter as $key => $value) {
541 if ($key ==
't.rowid' || $key ==
'rowid' || $key ==
't.fk_website' || $key ==
'fk_website' || $key ==
'status' || $key ==
't.status') {
542 $sqlwhere[] = $key.
" = ".((int) $value);
543 } elseif ($key ==
'type_container' || $key ==
't.type_container') {
544 $sqlwhere[] = $key.
" = '".$this->db->escape($value).
"'";
545 } elseif ($key ==
'lang' || $key ==
't.lang') {
546 $listoflang = array();
548 foreach (explode(
',', $value) as $tmpvalue) {
549 if ($tmpvalue ==
'null') {
553 $listoflang[] =
"'".$this->db->escape(substr(str_replace(
"'",
'', $tmpvalue), 0, 2)).
"'";
555 $stringtouse = $this->db->sanitize($key).
" IN (".$this->db->sanitize(implode(
',', $listoflang), 1).
")";
557 $stringtouse =
"(".$stringtouse.
" OR ".$this->db->sanitize($key).
" IS NULL)";
559 $sqlwhere[] = $stringtouse;
561 $sqlwhere[] = $this->db->sanitize($key).
" LIKE '%".$this->db->escape($value).
"%'";
565 if (count($sqlwhere) > 0) {
566 if (!empty($websiteid)) {
567 $sql .=
" AND (".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
569 $sql .=
" WHERE ".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere);
579 $this->errors[] = $errormessage;
580 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
584 $resql = $this->db->query($sql);
586 $obj = $this->db->fetch_object($resql);
591 $this->db->free($resql);
595 $this->error =
'Error '.$this->db->lasterror();
596 $this->errors[] = $this->error;
597 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
613 $this->keywords =
dol_trunc($this->keywords, 255,
'right',
'utf-8', 1);
614 if ($this->aliasalt) {
615 $this->aliasalt =
','.preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $this->aliasalt)).
',';
618 $this->pageurl = preg_replace(
'/[^a-z0-9\-\_]/i',
'', $this->pageurl);
619 $this->pageurl = preg_replace(
'/\-\-+/',
'-', $this->pageurl);
620 $this->pageurl = preg_replace(
'/^\-/',
'', $this->pageurl);
623 $this->lang = preg_replace(
'/[_-].*$/',
'', trim($this->lang));
625 if ($this->fk_page > 0) {
626 if (empty($this->lang)) {
627 $this->error =
"ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother";
631 $tmppage->fetch($this->fk_page);
632 if ($tmppage->lang == $this->lang) {
633 $this->error =
"ErrorLanguageOfTranslatedPageIsSameThanThisPage";
648 public function delete(
User $user, $notrigger = 0)
656 foreach ($this->childtablesoncascade as $table) {
657 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$table;
658 $sql .=
" WHERE fk_website_page = ".(int) $this->
id;
660 $result = $this->db->query($sql);
663 $this->errors[] = $this->db->lasterror();
677 $websiteobj =
new Website($this->db);
678 $result = $websiteobj->fetch($this->fk_website);
681 global $dolibarr_main_data_root;
682 $pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$websiteobj->ref;
684 $filealias = $pathofwebsite.
'/'.$this->pageurl.
'.php';
685 $filetpl = $pathofwebsite.
'/page'.$this->
id.
'.tpl.php';
690 $this->error = $websiteobj->error;
691 $this->errors = $websiteobj->errors;
715 public function createFromClone(
User $user, $fromid, $newref, $newlang =
'', $istranslation = 0, $newwebsite = 0, $newtitle =
'', $website =
null)
717 global $hookmanager, $langs;
727 if (empty($newref) && !empty($newtitle)) {
732 if (empty($newref)) {
733 $langs->load(
"errors");
734 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WEBSITE_TITLE"));
738 if ($istranslation) {
739 if (is_null($website)) {
740 $website =
new Website($this->db);
742 $website->fetch(
$object->fk_website);
744 if ($website->id != $newwebsite) {
745 $langs->load(
"errors");
746 $this->error = $langs->trans(
"WebsiteMustBeSameThanClonedPageIfTranslation");
762 $object->fk_user_creat = $user->id;
767 if (!empty($newlang)) {
771 if ($istranslation) {
772 if ($website->lang == $newlang) {
782 if (!empty($newwebsite)) {
783 $object->fk_website = $newwebsite;
786 $object->status = self::STATUS_DRAFT;
789 $object->context[
'createfromclone'] =
'createfromclone';
790 $result =
$object->create($user);
794 $this->errors =
$object->errors;
795 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
798 if ($istranslation) {
799 if ($website->lang == $newlang) {
801 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"website_page SET fk_page = ".((int) $result).
" WHERE rowid = ".((int) $fromid);
803 $result = $this->db->query($sql);
806 $this->error = $this->db->lasterror();
811 unset(
$object->context[
'createfromclone']);
819 $this->db->rollback();
836 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $maxlen = 24, $morecss =
'')
838 global $langs, $conf, $db;
839 global $dolibarr_main_authentication, $dolibarr_main_demo;
844 $label =
'<u>'.$langs->trans(
"Page").
'</u>';
846 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->
ref.
'<br>';
847 $label .=
'<b>'.$langs->trans(
'ID').
':</b> '.$this->
id.
'<br>';
848 $label .=
'<b>'.$langs->trans(
'Title').
':</b> '.$this->title.
'<br>';
849 $label .=
'<b>'.$langs->trans(
'Language').
':</b> '.$this->lang;
851 $url = DOL_URL_ROOT.
'/website/index.php?websiteid='.$this->fk_website.
'&pageid='.$this->id;
854 if (empty($notooltip)) {
856 $label = $langs->trans(
"ShowMyObject");
857 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
859 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
860 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
862 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
865 $linkstart =
'<a href="'.$url.
'"';
866 $linkstart .= $linkclose.
'>';
871 $result .= $linkstart;
873 $result .=
img_picto(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
875 if ($withpicto != 2) {
876 $result .= $this->ref;
907 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
910 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Offline');
911 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Online');
912 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Offline');
913 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Online');
916 $statusType =
'status5';
917 if ($status == self::STATUS_VALIDATED) {
918 $statusType =
'status4';
921 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
936 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
954 $this->fk_website = 0;
955 $this->type_container =
'page';
956 $this->pageurl =
'specimen';
957 $this->aliasalt =
'specimenalt';
958 $this->title =
'My Page';
961 $this->keywords =
'keyword1, keyword2';
962 $this->allowed_in_frames = 1;
963 $this->htmlheader =
'';
964 $this->content =
'<html><body>This is a html content</body></html>';
965 $this->
status = self::STATUS_DRAFT;
966 $this->grabbed_from =
'';
967 $this->date_creation = $now - (24 * 30 * 3600);
968 $this->date_modification = $now - (24 * 7 * 3600);
969 $this->fk_user_creat = $user->id;
970 $this->author_alias =
'mypublicpseudo';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Parent class of all other business classes (invoices, contracts, proposals, orders,...
createCommon(User $user, $notrigger=0)
Create object in the database.
updateCommon(User $user, $notrigger=0)
Update object into database.
setCategoriesCommon($categories, $type_categ='', $remove_existing=true)
Sets object to given categories.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
__construct(DoliDB $db)
Constructor.
update(User $user, $notrigger=0)
Update object into database.
create(User $user, $notrigger=0)
Create object into database.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
fetch($id, $website_id=null, $page=null, $aliasalt=null)
Load object in memory from the database.
LibStatut($status, $mode=0)
Return the label of a given status.
createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0, $newtitle='', $website=null)
Load an object from its id and create a new one in database.
fetchAll($websiteid='', $sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Return array of all web site pages.
getLibStatut($mode=0)
Return the label of the status.
setCategories($categories)
Sets object to given categories.
getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
Return a link to the user card (with optionally the picto) Use this->id,this->lastname,...
countAll($websiteid, $filter='', $filtermode='AND')
Count objects in the database.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dol_now($mode='auto')
Return date for now.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dolKeepOnlyPhpCode($str)
Keep only PHP code part from a HTML string page.