本文整理汇总了PHP中Profile::getFromDB方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getFromDB方法的具体用法?PHP Profile::getFromDB怎么用?PHP Profile::getFromDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::getFromDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/**
* Show profile form
*
* @param $items_id integer id of the profile
* @param $target value url of target
*
* @return nothing
**/
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
$profile = new Profile();
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile = new Profile();
$profile->getFromDB($profiles_id);
if ($profile->getField('interface') == 'central') {
$rights = $this->getAllRights();
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Helpdesk') . "</th></tr>\n";
$effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_racks_open_ticket'));
echo "<tr class='tab_bg_2'>";
echo "<td width='20%'>" . __('Associable items to a ticket') . "</td>";
echo "<td colspan='5'>";
Html::showCheckbox(array('name' => '_plugin_racks_open_ticket', 'checked' => $effective_rights['plugin_racks_open_ticket']));
echo "</td></tr>\n";
echo "</table>";
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例2: plugin_pdf_MassiveActionsProcess
function plugin_pdf_MassiveActionsProcess($data)
{
switch ($data["action"]) {
case "plugin_pdf_DoIt":
foreach ($data['item'] as $key => $val) {
if ($val) {
$tab_id[] = $key;
}
}
$_SESSION["plugin_pdf"]["type"] = $data["itemtype"];
$_SESSION["plugin_pdf"]["tab_id"] = serialize($tab_id);
echo "<script type='text/javascript'>\n location.href='../plugins/pdf/front/export.massive.php'</script>";
break;
case "plugin_pdf_allow":
$profglpi = new Profile();
$prof = new PluginPdfProfile();
foreach ($data['item'] as $key => $val) {
if ($profglpi->getFromDB($key) && $profglpi->fields['interface'] != 'helpdesk') {
if ($prof->getFromDB($key)) {
$prof->update(array('id' => $key, 'use' => $data['use']));
} else {
if ($data['use']) {
$prof->add(array('id' => $key, 'use' => $data['use']));
}
}
}
}
break;
}
}
示例3: showForm
/**
* Configuration form
**/
function showForm($id, $options = array())
{
$target = $this->getFormURL();
if (isset($options['target'])) {
$target = $options['target'];
}
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
$prof = new Profile();
if ($id) {
$this->getFromDB($id);
$prof->getFromDB($id);
}
echo "<form action='" . $target . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2' class='center b'>" . sprintf(_('%1$s %2$s'), 'gestion Vip :', Dropdown::getDropdownName("glpi_groups", $this->fields["id"]));
echo "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>Groupe Vip</td><td>";
Dropdown::showYesNo("isvip", $this->fields["isvip"]);
echo "</td></tr>";
if ($canedit) {
echo "<tr class='tab_bg_2'>";
echo "<td class='center' colspan='2'>";
echo "<input type='hidden' name='id' value={$id}>";
echo "<input type='submit' name='update_vip_group' value='Mettre à jour' class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}
示例4: showForm
/**
* profiles modification
**/
function showForm($id, $options = array())
{
$target = $this->getFormURL();
if (isset($options['target'])) {
$target = $options['target'];
}
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
$prof = new Profile();
if ($id) {
$this->getFromDB($id);
$prof->getFromDB($id);
}
echo "<form action='" . $target . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2' class='center b'>" . sprintf(__('%1$s %2$s'), __('Rights management'), $this->fields["name"]);
echo "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Use the tree', 'treeview') . "</td><td>";
Profile::dropdownNoneReadWrite("treeview", $this->fields["treeview"], 1, 1, 0);
echo "</td></tr>";
if ($canedit) {
echo "<tr class='tab_bg_1'>";
echo "<td class='center' colspan='2'>";
echo "<input type='hidden' name='id' value={$id}>";
echo "<input type='submit' name='update_user_profile' value='" . _sx('button', 'Update') . "'\n class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}
示例5: showForm
function showForm($ID, $options = array())
{
global $LANG;
if (!Profile::canView()) {
return false;
}
$canedit = self::canUpdate();
$profile = new Profile();
if ($ID) {
//$this->getFromDBByProfile($ID);
$profile->getFromDB($ID);
}
if ($canedit) {
echo "<form action='" . $profile->getFormURL() . "' method='post'>";
}
$rights = $this->getAllRights();
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2'));
if ($canedit) {
echo "<div class='center'>";
echo "<input type='hidden' name='id' value=" . $ID . ">";
echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
echo "</div>";
}
Html::closeForm();
$this->showLegend();
}
示例6: showForm
/**
* Show profile form
*
* @param $items_id integer id of the profile
* @param $target value url of target
*
* @return nothing
**/
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
$profile = new Profile();
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile = new Profile();
$profile->getFromDB($profiles_id);
$rights = array(array('itemtype' => 'PluginAddressingAddressing', 'label' => __('Generate reports', 'addressing'), 'field' => 'plugin_addressing'));
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
echo "<table class='tab_cadre_fixehov'>";
$effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_addressing_use_ping_in_equipment'));
echo "<tr class='tab_bg_2'>";
echo "<td width='20%'>" . __('Use ping on equipment form', 'addressing') . "</td>";
echo "<td colspan='5'>";
Html::showCheckbox(array('name' => '_plugin_addressing_use_ping_in_equipment[1_0]', 'checked' => $effective_rights['plugin_addressing_use_ping_in_equipment']));
echo "</td></tr>\n";
echo "</table>";
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例7: showForm
function showForm($ID, $options = array())
{
global $LANG;
$target = $this->getFormURL();
if (isset($options['target'])) {
$target = $options['target'];
}
if (!Session::haveRight("profile", "r")) {
return false;
}
$profil = new Profile();
if ($ID) {
$this->getFromDB($ID);
$profil->getFromDB($ID);
}
?>
<form action='<?php
echo $target;
?>
' method='post'>
<table class='tab_cadre_fixe'>
<tr>
<th colspan='2' class='center b'><?php
echo $LANG['plugin_ticketmail']['profile'][0] . " " . $profil->fields["name"];
?>
</th>
</tr>
<tr class='tab_bg_2'>
<td><?php
echo $LANG['plugin_ticketmail']['profile'][1];
?>
:</td>
<td>
<?php
Dropdown::showYesNo("show_ticketmail_onglet", $this->fields["show_ticketmail_onglet"]);
?>
</td>
</tr>
<tr class='tab_bg_1'>
<td class='center' colspan='2'>
<input type='hidden' name='id' value= '<?php
echo $ID;
?>
'>
<input type='submit' name='update_user_profile' value='<?php
echo __s('Update');
?>
' class='submit'>
</td>
</tr>
</table>
<?php
Html::closeForm();
}
示例8: showForm
function showForm($ID, $options = array())
{
$target = $this->getFormURL();
if (isset($options['target'])) {
$target = $options['target'];
}
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
$prof = new Profile();
if ($ID) {
$this->getFromDB($ID);
$prof->getFromDB($ID);
}
echo "<form action='" . $target . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . sprintf(__('%1$s %2$s'), __('Rights management', 'appliances'), $this->fields["name"]);
echo "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Appliances', 'appliances') . "</td><td>";
if ($prof->fields['interface'] != 'helpdesk') {
Profile::dropdownNoneReadWrite("appliance", $this->fields["appliance"], 1, 1, 1);
} else {
_e('No access');
}
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Linkable items to a ticket - Appliances') . "</td><td>";
if ($prof->fields['create_ticket']) {
Dropdown::showYesNo("open_ticket", $this->fields["open_ticket"]);
} else {
echo Dropdown::getYesNo(0);
}
echo "</td></tr>";
if ($canedit) {
echo "<tr class='tab_bg_1'>";
echo "<td class='center' colspan='2'>";
echo "<input type='hidden' name='id' value='" . $ID . "'>";
echo "<input type='submit' name='update_user_profile' value=\"" . _sx('button', 'Update') . "\"\n class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}
示例9: showForm
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, PURGE))) && $openform) {
$profile = new Profile();
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile = new Profile();
$profile->getFromDB($profiles_id);
$rights = $this->getAllRights();
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例10: showForm
function showForm($ID, $options = array())
{
global $DB;
$profile = new Profile();
if ($ID) {
$this->getFromDB($ID);
$profile->getFromDB($ID);
} else {
$this->getEmpty();
}
if ($canedit = self::canUpdate()) {
$options['colspan'] = 1;
$options['target'] = $profile->getFormURL();
$this->fields["id"] = $ID;
$this->showFormHeader($options);
}
$rights = $this->getGeneralRights();
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2'));
if ($canedit) {
$options['candel'] = false;
$this->showFormButtons($options);
}
}
示例11: showForm
function showForm($ID)
{
global $LANG;
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
$prof = new Profile();
if ($ID) {
$this->getFromDBByProfile($ID);
$prof->getFromDB($ID);
}
echo "<form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<th colspan='4' align='center'><strong>" . $LANG['plugin_simcard']['profile'][0] . " " . $prof->fields["name"] . "</strong></th>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . $LANG['plugin_simcard']['profile'][1] . ":</td><td>";
Profile::dropdownNoneReadWrite("simcard", $this->fields["simcard"], 1, 1, 1);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . $LANG['setup'][352] . " - " . $LANG['plugin_simcard']['profile'][1] . ":</td><td>";
if ($prof->fields['create_ticket']) {
Dropdown::showYesNo("open_ticket", $this->fields["open_ticket"]);
} else {
echo Dropdown::getYesNo(0);
}
echo "</td>";
echo "</tr>";
if ($canedit) {
echo "<tr class='tab_bg_1'>";
echo "<td align='center' colspan='2'>";
echo "<input type='hidden' name='id' value=" . $this->getID() . ">";
echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}
示例12: plugin_barcode_MassiveActionsProcess
function plugin_barcode_MassiveActionsProcess($data)
{
global $CFG_GLPI;
switch ($data['action']) {
case 'plugin_barcode_barcode':
case 'plugin_barcode_qrcode':
$pbConfig = new PluginBarcodeConfig();
$pbQRcode = new PluginBarcodeQRcode();
$itemtype = $data['itemtype'];
$item = new $itemtype();
$rand = mt_rand();
$number = 0;
$codes = array();
if ($data['eliminate'] > 0) {
for ($nb = 0; $nb < $data['eliminate']; $nb++) {
$codes[] = '';
}
}
if ($data['type'] == 'QRcode') {
foreach ($data['item'] as $key => $val) {
if ($val == 1) {
$filename = $pbQRcode->generateQRcode($itemtype, $key, $rand, $number, $data);
if ($filename) {
$codes[] = $filename;
$number++;
}
}
}
} else {
foreach ($data['item'] as $key => $val) {
if ($val == 1) {
$item->getFromDB($key);
if ($item->isField('otherserial')) {
$codes[] = $item->getField('otherserial');
}
}
}
}
if (count($codes) > 0) {
$params['codes'] = $codes;
$params['type'] = $data['type'];
$params['size'] = $data['size'];
$params['border'] = $data['border'];
$params['orientation'] = $data['orientation'];
$barcode = new PluginBarcodeBarcode();
$file = $barcode->printPDF($params);
$filePath = explode('/', $file);
$filename = $filePath[count($filePath) - 1];
$msg = "<a href='" . $CFG_GLPI['root_doc'] . '/plugins/barcode/front/send.php?file=' . urlencode($filename) . "'>" . __('Generated file', 'barcode') . "</a>";
Session::addMessageAfterRedirect($msg);
$pbQRcode->cleanQRcodefiles($rand, $number);
}
return true;
break;
case "plugin_barcode_allow":
$profglpi = new Profile();
$prof = new PluginBarcodeProfile();
foreach ($data['item'] as $key => $val) {
if ($profglpi->getFromDB($key) && $profglpi->fields['interface'] != 'helpdesk') {
if ($prof->getFromDB($key)) {
$prof->update(array('id' => $key, 'generate' => $data['generate'], 'config' => $data['config']));
} else {
if ($data['generate']) {
$prof->add(array('id' => $key, 'generate' => $data['generate']));
} else {
if ($data['config']) {
$prof->add(array('id' => $key, 'config' => $data['config']));
}
}
}
}
}
break;
}
}
示例13: showForProfile
/**
* @param $prof Profile object
**/
static function showForProfile(Profile $prof)
{
global $DB, $LANG;
$target = Toolbox::getItemTypeFormURL(__CLASS__);
$profiles_id = $prof->getField('id');
$prof->check($profiles_id, 'r');
$canedit = $prof->can($profiles_id, 'w');
$prof = new Profile();
if ($profiles_id) {
$prof->getFromDB($profiles_id);
}
$rights = self::getAllRights(array('profiles_id' => $profiles_id));
if ($canedit) {
echo "<form action='" . $target . "' method='post'>";
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4' class='center b'>";
printf(__('%1$s: %2$s'), __('Rights management by profil', 'reports'), $prof->fields["name"]);
echo "</th></tr>";
$plugname = array();
foreach (searchReport() as $key => $plug) {
$mod = $plug == 'reports' ? $key : "{$plug}_{$key}";
echo "<tr class='tab_bg_1'>";
if (!isset($plugname[$plug])) {
// Retrieve the plugin name
$function = "plugin_version_{$plug}";
$tmp = $function();
$plugname[$plug] = $tmp['name'];
}
echo "<td>" . $plugname[$plug] . "</td>";
if (strpos($key, 'stat') === false) {
echo "<td>" . _n('Report', 'Reports', 2) . "</td>";
} else {
echo "<td>" . __('Statistics') . "</td>";
}
echo "<td>" . $LANG["plugin_{$plug}"][$key] . "</td><td>";
if (isStat($key) && $prof->getField('statistic') == 1 || !isStat($key) && $prof->getField('reports') == 'r') {
Profile::dropdownNoneReadWrite($mod, isset($rights[$mod]) ? $rights[$mod] : '', 1, 1, 0);
} else {
// Can't access because missing right from GLPI core
// Profile::dropdownNoneReadWrite($mod,'',1,0,0);
echo "<input type='hidden' name='{$mod}' value='NULL'>" . __('No Access');
echo isStat($key) ? " **" : " *";
}
echo "</td></tr>";
}
if ($prof->getField('statistic') != 1 || $prof->getField('reports') != 'r') {
echo "<tr class='b tab_bg_4'><td colspan='4'>";
if ($prof->getField('reports') != 'r') {
echo '* ' . __('No right on Tools / Reports', 'reports') . '.<br>';
}
if ($prof->getField('statistic') != 1) {
echo '** ' . __('No right on Assistance / Statistics', 'reports') . '.';
}
echo "</td></tr>\n";
}
if ($canedit) {
echo "<tr class='tab_bg_1'>";
echo "<td class='center' colspan='4'>";
echo "<input type='hidden' name='profiles_id' value={$profiles_id}>";
echo "<input type='submit' name='update_user_profile' value='" . _sx('button', 'Update') . "'\n class='submit'>";
echo "</td></tr>\n";
echo "</table>";
Html::closeForm();
} else {
echo "</table>";
}
}
示例14: showForm
function showForm($ID, $options = array())
{
if (!Session::haveRight("profile", "r")) {
return false;
}
// $target = $this->getFormURL();
// if (isset($options['target'])) {
// $target = $options['target'];
// }
$prof = new Profile();
if ($ID) {
$this->getFromDBByProfile($ID);
$prof->getFromDB($ID);
}
$this->showFormHeader($options);
// echo "<form action='".$target."' method='post'>";
// echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'>";
echo "<th colspan='4'>" . sprintf(__('%1$s - %2$s'), __('Rights management', 'addressing'), $prof->fields["name"]) . "</th>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Generate reports', 'addressing') . "</td><td>";
Profile::dropdownNoneReadWrite("addressing", $this->fields["addressing"], 1, 1, 1);
echo "</td>";
echo "<td>" . __('Use ping on equipment form', 'addressing') . "</td><td>";
Dropdown::showYesNo("use_ping_in_equipment", $this->fields["use_ping_in_equipment"]);
echo "</td>";
echo "</tr>";
echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
$options['candel'] = false;
$this->showFormButtons($options);
}
示例15: showForm
function showForm($ID, $options = array())
{
global $LANG;
if (!Session::haveRight("profile", "r")) {
return false;
}
$prof = new Profile();
if ($ID) {
$this->getFromDBByProfile($ID);
$prof->getFromDB($ID);
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_2'>";
echo "<th colspan='4'>" . $LANG['plugin_mreporting']["name"] . " " . $prof->fields["name"] . "</th>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __("Display report") . ":</td><td>";
Profile::dropdownNoneReadWrite("reports", $this->fields["reports"], 1, 1, 0);
echo "</td>";
echo "<td>" . __("Setup") . ":</td><td>";
Profile::dropdownNoneReadWrite("config", $this->fields["config"], 1, 0, 1);
echo "</td>";
echo "</tr>";
echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
$options['candel'] = false;
$this->showFormButtons($options);
}