本文整理汇总了PHP中ModeleBoxes类的典型用法代码示例。如果您正苦于以下问题:PHP ModeleBoxes类的具体用法?PHP ModeleBoxes怎么用?PHP ModeleBoxes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModeleBoxes类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printBoxesArea
//.........这里部分代码省略.........
print 'jQuery("#boxcombo").hide();';
}
print '
jQuery("#left, #right").sortable({
/* placeholder: \'ui-state-highlight\', */
handle: \'.boxhandle\',
revert: \'invalid\',
items: \'.box\',
containment: \'.fiche\',
connectWith: \'.connectedSortable\',
stop: function(event, ui) {
updateBoxOrder(0);
}
});
jQuery(".boxclose").click(function() {
var self = this; // because JQuery can modify this
var boxid=self.id.substring(8);
var label=jQuery(\'#boxlabelentry\'+boxid).val();
jQuery(\'#boxto_\'+boxid).remove();
if (boxid > 0) jQuery(\'#boxcombo\').append(new Option(label, boxid));
updateBoxOrder(1);
});
});' . "\n";
print '</script>' . "\n";
}
$nbboxactivated = count($boxidactivatedforuser);
print load_fiche_titre($nbboxactivated ? $langs->trans("OtherInformationsBoxes") : '', $selectboxlist, '', '', 'otherboxes');
if ($nbboxactivated) {
$langs->load("boxes");
$langs->load("projects");
$emptybox = new ModeleBoxes($db);
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">' . "\n";
print '<div class="fichehalfleft">';
print "\n<!-- Box left container -->\n";
print '<div id="left" class="connectedSortable">' . "\n";
// Define $box_max_lines
$box_max_lines = 5;
if (!empty($conf->global->MAIN_BOXES_MAXLINES)) {
$box_max_lines = $conf->global->MAIN_BOXES_MAXLINES;
}
$ii = 0;
foreach ($boxactivated as $key => $box) {
if (!empty($user->conf->{$confuserzone}) && $box->fk_user == 0 || empty($user->conf->{$confuserzone}) && $box->fk_user != 0) {
continue;
}
if (empty($box->box_order) && $ii < $nbboxactivated / 2) {
$box->box_order = 'A' . sprintf("%02d", $ii + 1);
}
// When box_order was not yet set to Axx or Bxx and is still 0
if (preg_match('/^A/i', $box->box_order)) {
$ii++;
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
// Affichage boite key
$box->loadBox($box_max_lines);
$box->showBox();
}
}
if (empty($conf->browser->phone)) {
$emptybox->box_id = 'A';
$emptybox->info_box_head = array();
$emptybox->info_box_contents = array();
示例2: ModeleBoxes
// $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param";
// $sql.= " WHERE param LIKE 'MAIN_BOXES_%'";
// $resql = $db->query($sql);
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "boxes";
$sql .= " WHERE entity = " . $conf->entity;
$sql .= " AND box_id=" . $obj->box_id;
$resql = $db->query($sql);
$db->commit();
}
}
if ($action == 'switch') {
// On permute les valeur du champ box_order des 2 lignes de la table boxes
$db->begin();
$objfrom = new ModeleBoxes($db);
$objfrom->fetch($_GET["switchfrom"]);
$objto = new ModeleBoxes($db);
$objto->fetch($_GET["switchto"]);
$resultupdatefrom = 0;
$resultupdateto = 0;
if (is_object($objfrom) && is_object($objto)) {
$newfirst = $objto->box_order;
$newsecond = $objfrom->box_order;
if ($newfirst == $newsecond) {
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
}
$sql = "UPDATE " . MAIN_DB_PREFIX . "boxes SET box_order='" . $newfirst . "' WHERE rowid=" . $objfrom->rowid;
dol_syslog($sql);
$resultupdatefrom = $db->query($sql);
if (!$resultupdatefrom) {
示例3: printBoxesArea
/**
* Show a HTML Tab with boxes of a particular area including personalized choices of user
*
* @param User $user Object User
* @param String $areacode Code of area for pages (0=value for Home page)
* @return int <0 if KO, Nb of boxes shown of OK (0 to n)
*/
static function printBoxesArea($user, $areacode)
{
global $conf, $langs, $db;
include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
//$infobox=new InfoBox($db);
$boxactivated = InfoBox::listboxes($db, 'activated', $areacode, $user);
$arrayboxactivatedid = array();
foreach ($boxactivated as $box) {
$arrayboxactivatedid[$box->id] = $box->id;
}
$selectboxlist = '';
if ($conf->use_javascript_ajax) {
$emptyuser = new User($db);
$boxavailable = InfoBox::listboxes($db, 'activated', $areacode, $emptyuser, $arrayboxactivatedid);
// Available here is activated for empty user
$arrayboxtoactivatelabel = array();
foreach ($boxavailable as $box) {
$arrayboxtoactivatelabel[$box->id] = $box->boxlabel;
}
$form = new Form($db);
$selectboxlist = $form->selectarray('boxcombo', $arrayboxtoactivatelabel, '', 1);
}
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#boxcombo").change(function() {
var boxid=jQuery("#boxcombo").val();
if (boxid > 0) {
var left_list = cleanSerialize(jQuery("#left").sortable("serialize"));
var right_list = cleanSerialize(jQuery("#right").sortable("serialize"));
var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
jQuery.ajax({ url: \'' . DOL_URL_ROOT . '/core/ajax/box.php?boxorder=\'+boxorder+\'&boxid=\'+boxid+\'&zone=' . $areacode . '&userid=' . $user->id . '\',
async: false
});
//jQuery.get(\'' . DOL_URL_ROOT . '/core/ajax/box.php?boxorder=\'+boxorder+\'&boxid=\'+boxid+\'&zone=' . $areacode . '&userid=' . $user->id . '\');
window.location.search=\'mainmenu=' . GETPOST("mainmenu") . '&leftmenu=' . GETPOST('leftmenu') . '&action=addbox&boxid=\'+boxid;
//window.location.href=\'' . $_SERVER["PHP_SELF"] . '\';
}
});';
if (!count($arrayboxtoactivatelabel)) {
print 'jQuery("#boxcombo").hide();';
}
print '
});
</script>';
print load_fiche_titre(count($boxactivated) ? $langs->trans("OtherInformationsBoxes") : '', $selectboxlist, '', '', 'otherboxes');
if (count($boxactivated)) {
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">' . "\n";
print '<div class="fichehalfleft">';
print "\n<!-- Box left container -->\n";
print '<div id="left" class="connectedSortable">' . "\n";
// Define $box_max_lines
$box_max_lines = 5;
if (!empty($conf->global->MAIN_BOXES_MAXLINES)) {
$box_max_lines = $conf->global->MAIN_BOXES_MAXLINES;
}
$ii = 0;
foreach ($boxactivated as $key => $box) {
if (preg_match('/^A/i', $box->box_order)) {
$ii++;
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
// Affichage boite key
$box->loadBox($box_max_lines);
$box->showBox();
}
}
$emptybox = new ModeleBoxes($db);
$emptybox->box_id = 'A';
$emptybox->info_box_head = array();
$emptybox->info_box_contents = array();
$emptybox->showBox(array(), array());
print "</div>\n";
print "<!-- End box container -->\n";
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print "\n<!-- Box right container -->\n";
print '<div id="right" class="connectedSortable">' . "\n";
$ii = 0;
foreach ($boxactivated as $key => $box) {
if (preg_match('/^B/i', $box->box_order)) {
$ii++;
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
// Affichage boite key
$box->loadBox($box_max_lines);
$box->showBox();
}
}
$emptybox = new ModeleBoxes($db);
$emptybox->box_id = 'B';
$emptybox->info_box_head = array();
$emptybox->info_box_contents = array();
$emptybox->showBox(array(), array());
//.........这里部分代码省略.........
示例4: printBoxesArea
/**
* Show a HTML Tab with boxes of a particular area including personalized choices of user
*
* @param User $user Object User
* @param String $areacode Code of area for pages (0=value for Home page)
* @return int <0 if KO, Nb of boxes shown of OK (0 to n)
*/
function printBoxesArea($user,$areacode)
{
global $conf,$langs,$db;
$infobox=new InfoBox($db);
$boxarray=$infobox->listboxes($areacode,$user);
//$boxid_left = array();
//$boxid_right = array();
if (count($boxarray))
{
print_fiche_titre($langs->trans("OtherInformationsBoxes"),'','','','otherboxes');
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">'."\n";
print '<table width="100%" style="border-collapse: collapse; border: 0px; margin: 0px; padding: 0px;"><tr>';
// Affichage colonne gauche
print '<td width="50%" valign="top" class="notopnoleft" style="padding-right: 8px;">'."\n";
print "\n<!-- Box left container -->\n";
print '<div id="left" class="connectedSortable">'."\n";
$ii=0;
foreach ($boxarray as $key => $box)
{
if (preg_match('/^A/i',$box->box_order)) // column A
{
$ii++;
//print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
//$boxid_left[$key] = $box->box_id;
// Affichage boite key
$box->loadBox($conf->box_max_lines);
$box->showBox();
}
}
// If no box on left, we add an invisible empty box
// if ($ii==0)
// {
$emptybox=new ModeleBoxes($db);
$emptybox->box_id='A';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
$emptybox->showBox(array(),array());
// }
print "</div>\n";
print "<!-- End box container -->\n";
print "</td>\n";
// Affichage colonne droite
print '<td width="50%" valign="top">';
print "\n<!-- Box right container -->\n";
print '<div id="right" class="connectedSortable">'."\n";
$ii=0;
foreach ($boxarray as $key => $box)
{
if (preg_match('/^B/i',$box->box_order)) // colonne B
{
$ii++;
//print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
//$boxid_right[$key] = $boxarray[$key]->box_id;
// Affichage boite key
$box->loadBox($conf->box_max_lines);
$box->showBox();
}
}
// If no box on right, we show add an invisible empty box
// if ($ii==0)
// {
$emptybox=new ModeleBoxes($db);
$emptybox->box_id='B';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
$emptybox->showBox(array(),array());
// }
print "</div>\n";
print "<!-- End box container -->\n";
print "</td>";
print "</tr></table>\n";
print "\n";
print "</td></tr>";
print "</table>";
if ($conf->use_javascript_ajax)
//.........这里部分代码省略.........
示例5: showBox
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @return void
*/
function showBox($head = null, $contents = null)
{
global $langs, $conf;
parent::showBox($this->info_box_head, $this->info_box_contents);
if ($conf->global->SHOW_DIALOG_HOMEPAGE) {
$actioncejour = false;
$contents = $this->info_box_contents;
$nblines = count($contents);
$bcx = array();
$bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"';
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) {
print '<div id="dialog" title="' . $nblines . " " . $langs->trans("ActionsToDo") . '">';
print '<table width=100%>';
for ($i = 0, $n = $nblines; $i < $n; $i++) {
if (isset($contents[$i])) {
// on affiche que les évènement du jours ou passé
// qui ne sont pas à 100%
$actioncejour = true;
$var = !$var;
// TR
$logo = $contents[$i][0]['logo'];
$label = $contents[$i][1]['text'];
$urlevent = $contents[$i][1]['url'];
$logosoc = $contents[$i][2]['logo'];
$nomsoc = $contents[$i][3]['text'];
$urlsoc = $contents[$i][3]['url'];
$dateligne = $contents[$i][4]['text'];
$percentage = $contents[$i][5]['text'];
print '<tr ' . $bcx[$var] . '>';
print '<td align=center>';
print img_object("", $logo);
print '</td>';
print '<td align=center><a href="' . $urlevent . '">' . $label . '</a></td>';
print '<td align=center><a href="' . $urlsoc . '">' . img_object("", $logosoc) . " " . $nomsoc . '</a></td>';
print '<td align=center>' . $dateligne . '</td>';
print '<td align=center>' . $percentage . '</td>';
print '</tr>';
}
}
print '</table>';
}
print '</div>';
if ($actioncejour) {
print '<script>';
print '$( "#dialog" ).dialog({ autoOpen: true });';
if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1) {
print 'setTimeout(function(){';
print '$("#dialog").dialog("close");';
print '}, ' . $conf->global->SHOW_DIALOG_HOMEPAGE * 1000 . ');';
}
print '</script>';
} else {
print '<script>';
print '$( "#dialog" ).dialog({ autoOpen: false });';
print '</script>';
}
}
}
示例6: showBox
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @return void
*/
function showBox($head = null, $contents = null)
{
parent::showBox($this->info_box_head, $this->info_box_contents);
}
示例7: showBox
/**
* Method to show box. Called by Dolibarr eatch time it wants to display the box.
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @return void
*/
public function showBox($head = null, $contents = null)
{
// You may make your own code here…
// … or use the parent's class function using the provided head and contents templates
parent::showBox($this->info_box_head, $this->info_box_contents);
}