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));
241 public function fetch($id, $website_id =
null, $page =
null, $aliasalt =
null)
247 $sql .=
" t.fk_website,";
248 $sql .=
' t.type_container,';
249 $sql .=
" t.pageurl,";
250 $sql .=
" t.aliasalt,";
252 $sql .=
" t.description,";
254 $sql .=
" t.keywords,";
255 $sql .=
" t.htmlheader,";
256 $sql .=
" t.content,";
258 $sql .=
" t.fk_page,";
259 $sql .=
" t.allowed_in_frames,";
260 $sql .=
" t.status,";
261 $sql .=
" t.grabbed_from,";
262 $sql .=
" t.date_creation,";
263 $sql .=
" t.tms as date_modification,";
264 $sql .=
" t.fk_user_creat,";
265 $sql .=
" t.author_alias,";
266 $sql .=
" t.fk_user_modif,";
267 $sql .=
" t.import_key,";
268 $sql .=
" t.object_type,";
269 $sql .=
" t.fk_object";
270 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
272 $sql .=
' WHERE 1 = 1';
274 $sql .=
' AND t.rowid = '.((int) $id);
277 $sql .=
' AND t.rowid <> '.abs($id);
279 if (
null !== $website_id) {
280 $sql .=
" AND t.fk_website = '".$this->db->escape($website_id).
"'";
284 $tmppage = explode(
'/', $page);
285 if (!empty($tmppage[1])) {
286 $pagetouse = $tmppage[1];
287 if (strlen($tmppage[0])) {
288 $langtouse = $tmppage[0];
291 $sql .=
" AND t.pageurl = '".$this->db->escape($pagetouse).
"'";
293 $sql .=
" AND t.lang = '".$this->db->escape($langtouse).
"'";
297 $sql .=
" AND (t.aliasalt LIKE '%,".$this->db->escape($aliasalt).
",%' OR t.aliasalt LIKE '%, ".$this->db->escape($aliasalt).
",%')";
301 $sql .= $this->db->plimit(1);
303 $resql = $this->db->query($sql);
305 $numrows = $this->db->num_rows($resql);
307 $obj = $this->db->fetch_object($resql);
309 $this->
id = $obj->rowid;
311 $this->fk_website = $obj->fk_website;
312 $this->type_container = $obj->type_container;
314 $this->pageurl = $obj->pageurl;
315 $this->
ref = $obj->pageurl;
316 $this->aliasalt = preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $obj->aliasalt));
318 $this->title = $obj->title;
320 $this->image = $obj->image;
321 $this->keywords = $obj->keywords;
322 $this->htmlheader = $obj->htmlheader;
323 $this->content = $obj->content;
324 $this->lang = $obj->lang;
325 $this->fk_page = $obj->fk_page;
326 $this->allowed_in_frames = $obj->allowed_in_frames;
327 $this->
status = $obj->status;
328 $this->grabbed_from = $obj->grabbed_from;
329 $this->date_creation = $this->db->jdate($obj->date_creation);
330 $this->date_modification = $this->db->jdate($obj->date_modification);
331 $this->fk_user_creat = $obj->fk_user_creat;
332 $this->author_alias = $obj->author_alias;
333 $this->fk_user_modif = $obj->fk_user_modif;
334 $this->import_key = $obj->import_key;
335 $this->object_type = $obj->object_type;
336 $this->fk_object = $obj->fk_object;
338 $this->db->free($resql);
346 $this->errors[] =
'Error '.$this->db->lasterror();
347 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
366 public function fetchAll($websiteid =
'', $sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
374 $sql .=
" t.fk_website,";
375 $sql .=
" t.type_container,";
376 $sql .=
" t.pageurl,";
377 $sql .=
" t.aliasalt,";
379 $sql .=
" t.description,";
381 $sql .=
" t.keywords,";
382 $sql .=
" t.htmlheader,";
383 $sql .=
" t.content,";
385 $sql .=
" t.fk_page,";
386 $sql .=
" t.allowed_in_frames,";
387 $sql .=
" t.status,";
388 $sql .=
" t.grabbed_from,";
389 $sql .=
" t.date_creation,";
390 $sql .=
" t.tms as date_modification,";
391 $sql .=
" t.fk_user_creat,";
392 $sql .=
" t.author_alias,";
393 $sql .=
" t.fk_user_modif,";
394 $sql .=
" t.import_key,";
395 $sql .=
" t.object_type,";
396 $sql .=
" t.fk_object";
397 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
398 if (!empty($websiteid)) {
399 $sql .=
' WHERE t.fk_website = '.((int) $websiteid);
403 if (is_array($filter)) {
406 if (count($filter) > 0) {
407 foreach ($filter as $key => $value) {
408 if ($key ==
't.rowid' || $key ==
'rowid' || $key ==
't.fk_website' || $key ==
'fk_website' || $key ==
'status' || $key ==
't.status') {
409 $sqlwhere[] = $key.
" = ".((int) $value);
410 } elseif ($key ==
'type_container' || $key ==
't.type_container') {
411 $sqlwhere[] = $key.
" = '".$this->db->escape($value).
"'";
412 } elseif ($key ==
'lang' || $key ==
't.lang') {
413 $listoflang = array();
415 foreach (explode(
',', $value) as $tmpvalue) {
416 if ($tmpvalue ==
'null') {
420 $listoflang[] =
"'".$this->db->escape(substr(str_replace(
"'",
'', $tmpvalue), 0, 2)).
"'";
422 $stringtouse = $this->db->sanitize($key).
" IN (".$this->db->sanitize(implode(
',', $listoflang), 1).
")";
424 $stringtouse =
"(".$stringtouse.
" OR ".$this->db->sanitize($key).
" IS NULL)";
426 $sqlwhere[] = $stringtouse;
428 $sqlwhere[] = $this->db->sanitize($key).
" LIKE '%".$this->db->escape($value).
"%'";
432 if (count($sqlwhere) > 0) {
433 if (!empty($websiteid)) {
434 $sql .=
" AND (".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
436 $sql .=
" WHERE ".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere);
446 $this->errors[] = $errormessage;
447 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
451 if (!empty($sortfield)) {
452 $sql .= $this->db->order($sortfield, $sortorder);
454 if (!empty($limit)) {
455 $sql .= $this->db->plimit($limit, $offset);
458 $resql = $this->db->query($sql);
460 $num = $this->db->num_rows($resql);
462 while ($obj = $this->db->fetch_object($resql)) {
463 $record =
new self($this->db);
465 $record->id = $obj->rowid;
466 $record->fk_website = $obj->fk_website;
467 $record->type_container = $obj->type_container;
468 $record->pageurl = $obj->pageurl;
469 $record->aliasalt = preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $obj->aliasalt));
470 $record->title = $obj->title;
471 $record->description = $obj->description;
472 $record->image = $obj->image;
473 $record->keywords = $obj->keywords;
474 $record->htmlheader = $obj->htmlheader;
475 $record->content = $obj->content;
476 $record->lang = $obj->lang;
477 $record->fk_page = $obj->fk_page;
478 $record->allowed_in_frames = $obj->allowed_in_frames;
479 $record->status = $obj->status;
480 $record->grabbed_from = $obj->grabbed_from;
481 $record->date_creation = $this->db->jdate($obj->date_creation);
482 $record->date_modification = $this->db->jdate($obj->date_modification);
483 $record->fk_user_creat = $obj->fk_user_creat;
484 $record->author_alias = $obj->author_alias;
485 $record->fk_user_modif = $obj->fk_user_modif;
486 $record->import_key = $obj->import_key;
487 $record->object_type = $obj->object_type;
488 $record->fk_object = $obj->fk_object;
490 $records[$record->id] = $record;
492 $this->db->free($resql);
496 $this->error =
'Error '.$this->db->lasterror();
497 $this->errors[] = $this->error;
498 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
513 public function countAll($websiteid, $filter =
'', $filtermode =
'AND')
519 $sql =
'SELECT COUNT(t.rowid) as nb';
520 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
521 $sql .=
' WHERE t.fk_website = '.((int) $websiteid);
524 if (is_array($filter)) {
527 if (count($filter) > 0) {
528 foreach ($filter as $key => $value) {
529 if ($key ==
't.rowid' || $key ==
'rowid' || $key ==
't.fk_website' || $key ==
'fk_website' || $key ==
'status' || $key ==
't.status') {
530 $sqlwhere[] = $key.
" = ".((int) $value);
531 } elseif ($key ==
'type_container' || $key ==
't.type_container') {
532 $sqlwhere[] = $key.
" = '".$this->db->escape($value).
"'";
533 } elseif ($key ==
'lang' || $key ==
't.lang') {
534 $listoflang = array();
536 foreach (explode(
',', $value) as $tmpvalue) {
537 if ($tmpvalue ==
'null') {
541 $listoflang[] =
"'".$this->db->escape(substr(str_replace(
"'",
'', $tmpvalue), 0, 2)).
"'";
543 $stringtouse = $this->db->sanitize($key).
" IN (".$this->db->sanitize(implode(
',', $listoflang), 1).
")";
545 $stringtouse =
"(".$stringtouse.
" OR ".$this->db->sanitize($key).
" IS NULL)";
547 $sqlwhere[] = $stringtouse;
549 $sqlwhere[] = $this->db->sanitize($key).
" LIKE '%".$this->db->escape($value).
"%'";
553 if (count($sqlwhere) > 0) {
554 if (!empty($websiteid)) {
555 $sql .=
" AND (".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
557 $sql .=
" WHERE ".implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere);
567 $this->errors[] = $errormessage;
568 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
572 $resql = $this->db->query($sql);
574 $obj = $this->db->fetch_object($resql);
579 $this->db->free($resql);
583 $this->error =
'Error '.$this->db->lasterror();
584 $this->errors[] = $this->error;
585 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
601 $this->keywords =
dol_trunc($this->keywords, 255,
'right',
'utf-8', 1);
602 if ($this->aliasalt) {
603 $this->aliasalt =
','.preg_replace(
'/,+$/',
'', preg_replace(
'/^,+/',
'', $this->aliasalt)).
',';
606 $this->pageurl = preg_replace(
'/[^a-z0-9\-\_]/i',
'', $this->pageurl);
607 $this->pageurl = preg_replace(
'/\-\-+/',
'-', $this->pageurl);
608 $this->pageurl = preg_replace(
'/^\-/',
'', $this->pageurl);
611 $this->lang = preg_replace(
'/[_-].*$/',
'', trim($this->lang));
613 if ($this->fk_page > 0) {
614 if (empty($this->lang)) {
615 $this->error =
"ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother";
619 $tmppage->fetch($this->fk_page);
620 if ($tmppage->lang == $this->lang) {
621 $this->error =
"ErrorLanguageOfTranslatedPageIsSameThanThisPage";
636 public function delete(
User $user, $notrigger = 0)
644 foreach ($this->childtablesoncascade as $table) {
645 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$table;
646 $sql .=
" WHERE fk_website_page = ".(int) $this->
id;
648 $result = $this->db->query($sql);
651 $this->errors[] = $this->db->lasterror();
665 $websiteobj =
new Website($this->db);
666 $result = $websiteobj->fetch($this->fk_website);
669 global $dolibarr_main_data_root;
670 $pathofwebsite = $dolibarr_main_data_root.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$websiteobj->ref;
672 $filealias = $pathofwebsite.
'/'.$this->pageurl.
'.php';
673 $filetpl = $pathofwebsite.
'/page'.$this->
id.
'.tpl.php';
678 $this->error = $websiteobj->error;
679 $this->errors = $websiteobj->errors;
703 public function createFromClone(
User $user, $fromid, $newref, $newlang =
'', $istranslation = 0, $newwebsite = 0, $newtitle =
'', $website =
null)
705 global $hookmanager, $langs;
715 if (empty($newref) && !empty($newtitle)) {
720 if (empty($newref)) {
721 $langs->load(
"errors");
722 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WEBSITE_TITLE"));
726 if ($istranslation) {
727 if (is_null($website)) {
728 $website =
new Website($this->db);
730 $website->fetch(
$object->fk_website);
732 if ($website->id != $newwebsite) {
733 $langs->load(
"errors");
734 $this->error = $langs->trans(
"WebsiteMustBeSameThanClonedPageIfTranslation");
750 $object->fk_user_creat = $user->id;
755 if (!empty($newlang)) {
759 if ($istranslation) {
760 if ($website->lang == $newlang) {
770 if (!empty($newwebsite)) {
771 $object->fk_website = $newwebsite;
774 $object->status = self::STATUS_DRAFT;
777 $object->context[
'createfromclone'] =
'createfromclone';
778 $result =
$object->create($user);
782 $this->errors =
$object->errors;
783 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
786 if ($istranslation) {
787 if ($website->lang == $newlang) {
789 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"website_page SET fk_page = ".((int) $result).
" WHERE rowid = ".((int) $fromid);
791 $result = $this->db->query($sql);
794 $this->error = $this->db->lasterror();
799 unset(
$object->context[
'createfromclone']);
807 $this->db->rollback();
824 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $maxlen = 24, $morecss =
'')
826 global $langs, $conf, $db;
827 global $dolibarr_main_authentication, $dolibarr_main_demo;
832 $label =
'<u>'.$langs->trans(
"Page").
'</u>';
834 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->
ref.
'<br>';
835 $label .=
'<b>'.$langs->trans(
'ID').
':</b> '.$this->
id.
'<br>';
836 $label .=
'<b>'.$langs->trans(
'Title').
':</b> '.$this->title.
'<br>';
837 $label .=
'<b>'.$langs->trans(
'Language').
':</b> '.$this->lang;
839 $url = DOL_URL_ROOT.
'/website/index.php?websiteid='.$this->fk_website.
'&pageid='.$this->id;
842 if (empty($notooltip)) {
844 $label = $langs->trans(
"ShowMyObject");
845 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
847 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
848 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
850 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
853 $linkstart =
'<a href="'.$url.
'"';
854 $linkstart .= $linkclose.
'>';
859 $result .= $linkstart;
861 $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);
863 if ($withpicto != 2) {
864 $result .= $this->ref;
895 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
898 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Offline');
899 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Online');
900 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Offline');
901 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Online');
904 $statusType =
'status5';
905 if ($status == self::STATUS_VALIDATED) {
906 $statusType =
'status4';
909 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
924 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
942 $this->fk_website = 0;
943 $this->type_container =
'page';
944 $this->pageurl =
'specimen';
945 $this->aliasalt =
'specimenalt';
946 $this->title =
'My Page';
949 $this->keywords =
'keyword1, keyword2';
950 $this->allowed_in_frames = 1;
951 $this->htmlheader =
'';
952 $this->content =
'<html><body>This is a html content</body></html>';
953 $this->
status = self::STATUS_DRAFT;
954 $this->grabbed_from =
'';
955 $this->date_creation = $now - (24 * 30 * 3600);
956 $this->date_modification = $now - (24 * 7 * 3600);
957 $this->fk_user_creat = $user->id;
958 $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.