本文整理汇总了PHP中Profile::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getField方法的具体用法?PHP Profile::getField怎么用?PHP Profile::getField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::getField方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: purgeProfiles
static function purgeProfiles(Profile $prof)
{
$plugprof = new ProfileRight();
foreach (self::getAllRights(true) as $right) {
$plugprof->deleteByCriteria(array('profiles_id' => $prof->getField("id"), 'name' => $right));
}
}
示例3: showForProfile
/**
* @param $prof Profile object
**/
static function showForProfile(Profile $prof)
{
global $DB;
$canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE));
if ($canedit) {
echo "<form method='post' action='" . $prof->getFormURL() . "'>";
}
$rights = self::getAllRights();
$prof->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Rights management by profil', 'reports')));
if ($canedit) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $prof->getField('id')));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例4: showForm
public 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('rights' => self::getRights($profile->getField('interface'),);
$rights = array();
if ($profile->getField('interface') == 'central') {
$rights = $this->getAllRights();
}
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Orders', 'order')));
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>";
}
示例5: purgeProfiles
static function purgeProfiles(Profile $prof)
{
$plugprof = new self();
$plugprof->deleteByCriteria(array('profiles_id' => $prof->getField("id")));
}
示例6: cleanProfiles
static function cleanProfiles(Profile $prof)
{
$plugprof = new self();
$plugprof->delete(array('id' => $prof->getField("id")));
}
示例7: purgeProfiles
static function purgeProfiles(Profile $prof)
{
$plugprof = new self();
$plugprof->cleanProfiles($prof->getField("id"));
}
示例8: 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>";
}
}