本文整理汇总了PHP中self::getFromDB方法的典型用法代码示例。如果您正苦于以下问题:PHP self::getFromDB方法的具体用法?PHP self::getFromDB怎么用?PHP self::getFromDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::getFromDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadInSession
static function loadInSession()
{
unset($_SESSION['talk_userprefs']);
$self = new self();
if ($self->getFromDB(Session::getLoginUserID())) {
$_SESSION['talk_userprefs'] = $self->fields;
} else {
$self->add(array('users_id' => Session::getLoginUserID()));
$self->getFromDB(Session::getLoginUserID());
$_SESSION['talk_userprefs'] = $self->fields;
}
}
示例2: showFormAlerts
static function showFormAlerts($target)
{
$self = new self();
$self->getFromDB(1);
echo "<form action='{$target}' method='post'>";
echo "<input type='hidden' name='id' value='1'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Reminders frequency', 'additionalalerts') . " " . PluginAdditionalalertsInfocomAlert::getTypeName(2) . "</td><td>";
Alert::dropdownYesNo(array('name' => "use_infocom_alert", 'value' => $self->fields["use_infocom_alert"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td >" . __('Reminders frequency', 'additionalalerts') . " " . __('New imported computers from OCS-NG', 'additionalalerts') . "</td><td>";
Alert::dropdownYesNo(array('name' => "use_newocs_alert", 'value' => $self->fields["use_newocs_alert"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td >" . __('OCS-NG Synchronization alerts', 'additionalalerts') . "</td><td>";
Alert::dropdownIntegerNever('delay_ocs', $self->fields["delay_ocs"], array('max' => 99));
echo " " . _n('Day', 'Days', 2) . "</td></tr>";
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td class='center' colspan='2'>";
echo "<input type='hidden' name='id' value='1'>";
echo "<input class='submit' type='submit' name='update' value='" . _sx('button', 'Save') . "'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
}
示例3: createFirstConfig
static function createFirstConfig()
{
$conf = new self();
if (!$conf->getFromDB(1)) {
$conf->add(array('id' => 1, 'add_waiting' => 1));
}
}
示例4: showForGroup
static function showForGroup(Group $group)
{
global $DB;
$ID = $group->getField('id');
if (!$group->can($ID, READ)) {
return false;
}
$canedit = $group->can($ID, UPDATE);
if ($canedit) {
// Get data
$item = new self();
if (!$item->getFromDB($ID)) {
$item->getEmpty();
}
$rand = mt_rand();
echo "<form name='group_level_form{$rand}' id='group_level_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<input type='hidden' name='" . self::$items_id . "' value='{$ID}' />";
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th>" . __('Level attribution', 'itilcategorygroups') . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
Dropdown::showFromArray('lvl', array(NULL => "---", 1 => __('Level 1', 'itilcategorygroups'), 2 => __('Level 2', 'itilcategorygroups'), 3 => __('Level 3', 'itilcategorygroups'), 4 => __('Level 4', 'itilcategorygroups')), array('value' => $item->fields['lvl']));
echo "</td></tr>";
echo "</td><td class='center'>";
if ($item->fields["id"]) {
echo "<input type='hidden' name='id' value='" . $item->fields["id"] . "'>";
echo "<input type='submit' name='update' value=\"" . __('Save') . "\"\n class='submit'>";
} else {
echo "<input type='submit' name='add' value=\"" . __('Save') . "\" class='submit'>";
}
echo "</td></tr>";
echo "</table></div>";
Html::closeForm();
}
}
示例5: changeGroup
static function changeGroup()
{
$grp = new self();
if ($grp->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
$_SESSION["glpi_plugin_vip_profile"] = $grp->fields;
} else {
unset($_SESSION["glpi_plugin_vip_profile"]);
}
}
示例6: changeprofile
static function changeprofile()
{
$prof = new self();
if ($prof->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
$_SESSION["glpi_plugin_customfields_profiles"] = $prof->fields;
} else {
unset($_SESSION["glpi_plugin_customfields_profiles"]);
}
}
示例7: changeprofile
static function changeprofile()
{
$tmp = new self();
if ($tmp->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
$_SESSION["glpi_plugin_winadminpassword_profile"] = $tmp->fields;
} else {
unset($_SESSION["glpi_plugin_winadminpassword_profile"]);
}
}
示例8: select
static function select()
{
$prof = new self();
if ($prof->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
$_SESSION["glpi_plugin_appliances_profiles"] = $prof->fields;
} else {
unset($_SESSION["glpi_plugin_appliances_profiles"]);
}
}
示例9: changeProfile
static function changeProfile()
{
$profil = new self();
if ($profil->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
$_SESSION["glpi_plugin_ticketmail_profile"] = $profil->fields;
} else {
unset($_SESSION["glpi_plugin_ticketmail_profile"]);
}
}
示例10: getStatusColor
static function getStatusColor($ID)
{
$self = new self();
if ($self->getFromDB($ID)) {
if (!empty($self->fields['color'])) {
return $self->fields['color'];
}
}
return "#CCCCCC";
}
示例11: changeprofile
static function changeprofile()
{
if (isset($_SESSION['glpiactiveprofile']['id'])) {
$tmp = new self();
if ($tmp->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
$_SESSION["glpi_plugin_surveyticket_profile"] = $tmp->fields;
} else {
unset($_SESSION["glpi_plugin_surveyticket_profile"]);
}
}
}
示例12: getConfig
static function getConfig($update = false)
{
static $config = null;
if (is_null($config)) {
$config = new self();
}
if ($update) {
$config->getFromDB(1);
}
return $config;
}
示例13: transfer
static function transfer($ID, $entity)
{
global $DB;
$temp = new self();
if ($ID <= 0 || !$temp->getFromDB($ID)) {
return 0;
}
$query = "SELECT `id`\n FROM `" . $temp->getTable() . "`\n WHERE `entities_id` = '" . $entity . "'\n AND `name` = '" . addslashes($temp->fields['name']) . "'";
foreach ($DB->request($query) as $data) {
return $data['id'];
}
$input = $temp->fields;
$input['entities_id'] = $entity;
unset($input['id']);
return $temp->add($input);
}
示例14: checkWizardSetup
static function checkWizardSetup($ID, $field)
{
global $DB;
if ($ID > 0) {
$resource = new PluginResourcesResource();
$self = new self();
if ($resource->getFromDB($ID)) {
if ($self->getFromDB($resource->fields["plugin_resources_contracttypes_id"])) {
if ($self->fields[$field] > 0) {
return true;
}
}
}
}
return false;
}
示例15: showForItemtype
static function showForItemtype($type)
{
global $DB;
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
echo "<form action='" . Toolbox::getItemTypeSearchURL(__CLASS__) . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
$itemtype = $type->fields['itemtype'];
echo "<tr><th colspan='2' align='center'><strong>";
echo __("Rights assignment") . ": ";
echo $itemtype::getTypeName();
echo "</strong></th></tr>";
foreach (getAllDatasFromTable('glpi_profiles') as $profile) {
echo "<tr><th colspan='2' align='center'><strong>";
echo __("Profile") . " " . $profile['name'] . "</strong></th></tr>";
$pgf_find = self::getProfileforItemtype($profile['id'], $itemtype);
if (!count($pgf_find) > 0) {
self::createAccess($profile['id']);
$pgf_find = self::getProfileforItemtype($profile['id'], $itemtype);
}
$PluginGenericobjectProfile = new self();
$PluginGenericobjectProfile->getFromDB($pgf_find['id']);
$prefix = "profiles[" . $pgf_find['id'] . "]";
if ($profile['interface'] == 'central') {
echo "<tr class='tab_bg_2'>";
echo "<td>" . __("Access object", "genericobject") . ":</td><td>";
Profile::dropdownNoneReadWrite($prefix . "[right]", $PluginGenericobjectProfile->fields['right'], 1, 1, 1);
echo "</td></tr>";
}
if ($type->canUseTickets()) {
echo "<tr class='tab_bg_2'>";
echo "<td>" . __("Associate tickets to this object", "genericobject") . ":</td><td>";
Dropdown::showYesNo($prefix . "[open_ticket]", $PluginGenericobjectProfile->fields['open_ticket']);
echo "</td></tr>";
}
}
if ($canedit) {
echo "<tr class='tab_bg_1'>";
echo "<td align='center' colspan='2'>";
echo "<input type='submit' name='update_all_rights' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}