26 require_once DOL_DOCUMENT_ROOT.
"/core/boxes/modules_boxes.php";
36 public $boxcode =
"box_last_knowledgerecord";
41 public $boximg =
"knowledgemanagement";
51 public $depends = array(
"knowledgemanagement");
66 public $info_box_head = array();
71 public $info_box_contents = array();
81 $langs->load(
"boxes",
"languages");
84 $this->boxlabel = $langs->transnoentitiesnoconv(
"BoxLastKnowledgerecord");
99 require_once DOL_DOCUMENT_ROOT.
"/knowledgemanagement/class/knowledgerecord.class.php";
101 $text = $langs->trans(
"BoxLastKnowledgerecordDescription", $max);
102 $this->info_box_head = array(
107 $this->info_box_contents[0][0] = array(
108 'td' =>
'class="left"',
109 'text' => $langs->trans(
"BoxLastKnowledgerecordContent"),
112 if ($user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'read')) {
113 $sql =
'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status';
114 $sql .=
" FROM ".MAIN_DB_PREFIX.
"knowledgemanagement_knowledgerecord as k";
115 $sql .=
" WHERE k.entity IN (".getEntity(
'knowledgemanagement').
")";
118 $sql .=
" AND k.fk_soc= ".((int) $user->socid);
121 $sql.=
" AND k.status > 0";
123 $sql .=
" ORDER BY k.date_creation DESC, k.rowid DESC ";
124 $sql .= $this->db->plimit($max, 0);
126 $resql = $this->db->query(
$sql);
128 $num = $this->db->num_rows($resql);
133 $objp = $this->db->fetch_object($resql);
135 $datec = $this->db->jdate($objp->date_creation);
138 $knowledgerecord->id = $objp->id;
139 $knowledgerecord->date_creation = $objp->date_creation;
140 $knowledgerecord->ref = $objp->ref;
141 $knowledgerecord->status = $objp->status;
142 $knowledgerecord->question = $objp->question;
147 $this->info_box_contents[$i][$r] = array(
148 'td' =>
'class="nowraponall"',
149 'text' => $knowledgerecord->getNomUrl(1),
155 $this->info_box_contents[$i][$r] = array(
156 'td' =>
'class="tdoverflowmax200"',
158 'url' => DOL_URL_ROOT.
"/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id),
163 $labellang = ($objp->lang ? $langs->trans(
'Language_'.$objp->lang) :
'');
164 $this->info_box_contents[$i][$r] = array(
165 'td' =>
'class="tdoverflowmax100"',
166 'text' =>
picto_from_langcode($objp->lang,
'class="paddingrightonly saturatemedium opacitylow"') . $labellang,
172 $this->info_box_contents[$i][$r] = array(
179 $this->info_box_contents[$i][$r] = array(
180 'td' =>
'class="right nowraponall"',
181 'text' => $knowledgerecord->getLibStatut(3),
189 $this->info_box_contents[$i][0] = array(
191 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxLastTicketNoRecordedTickets").
'</span>',
198 $this->info_box_contents[0][0] = array(
200 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>',
213 public function showBox($head =
null, $contents =
null, $nooutput = 0)
215 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
Class for KnowledgeRecord.
__construct($db, $param='')
Constructor.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
loadBox($max=5)
Load data into info_box_contents array to show array later.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...