CommonITILObject::showActorAddFormOnCreate PHP Метод

showActorAddFormOnCreate() публичный Метод

show user add div on creation
public showActorAddFormOnCreate ( $type, array $options ) : nothing
$type integer actor type
$options array array options for default values ($options of showForm)
Результат nothing display
    function showActorAddFormOnCreate($type, array $options)
    {
        global $CFG_GLPI;
        $typename = self::getActorFieldNameType($type);
        $itemtype = $this->getType();
        echo self::getActorIcon('user', $type);
        // For ticket templates : mandatories
        if ($itemtype == 'Ticket' && isset($options['_tickettemplate'])) {
            echo $options['_tickettemplate']->getMandatoryMark("_users_id_" . $typename);
        }
        echo " ";
        if (!isset($options["_right"])) {
            $right = $this->getDefaultActorRightSearch($type);
        } else {
            $right = $options["_right"];
        }
        if ($options["_users_id_" . $typename] == 0) {
            $options["_users_id_" . $typename] = $this->getDefaultActor($type);
        }
        $rand = mt_rand();
        $actor_name = '_users_id_' . $typename;
        if ($type == CommonITILActor::OBSERVER) {
            $actor_name = '_users_id_' . $typename . '[]';
        }
        $params = array('name' => $actor_name, 'value' => $options["_users_id_" . $typename], 'right' => $right, 'rand' => $rand, 'entity' => isset($options['entities_id']) ? $options['entities_id'] : $options['entity_restrict']);
        //only for active ldap and corresponding right
        $ldap_methods = getAllDatasFromTable('glpi_authldaps', '`is_active`=1');
        if (count($ldap_methods) && Session::haveRight('user', User::IMPORTEXTAUTHUSERS)) {
            $params['ldap_import'] = true;
        }
        if ($this->userentity_oncreate && $type == CommonITILActor::REQUESTER) {
            $params['on_change'] = 'this.form.submit()';
            unset($params['entity']);
        }
        $params['_user_index'] = 0;
        if (isset($options['_user_index'])) {
            $params['_user_index'] = $options['_user_index'];
        }
        if ($CFG_GLPI['use_mailing']) {
            $paramscomment = array('value' => '__VALUE__', 'field' => "_users_id_" . $typename . "_notif", '_user_index' => $params['_user_index'], 'allow_email' => $type == CommonITILActor::REQUESTER || $type == CommonITILActor::OBSERVER, 'use_notification' => $options["_users_id_" . $typename . "_notif"]['use_notification']);
            if (isset($options["_users_id_" . $typename . "_notif"]['alternative_email'])) {
                $paramscomment['alternative_email'] = $options["_users_id_" . $typename . "_notif"]['alternative_email'];
            }
            $params['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "notif_" . $typename . "_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment);
        }
        if ($itemtype == 'Ticket' && $type == CommonITILActor::ASSIGN) {
            $toupdate = array();
            if (isset($params['toupdate']) && is_array($params['toupdate'])) {
                $toupdate[] = $params['toupdate'];
            }
            $toupdate[] = array('value_fieldname' => 'value', 'to_update' => "countassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('users_id_assign' => '__VALUE__'));
            $params['toupdate'] = $toupdate;
        }
        // List all users in the active entities
        User::dropdown($params);
        if ($itemtype == 'Ticket') {
            // display opened tickets for user
            if ($type == CommonITILActor::REQUESTER && $options["_users_id_" . $typename] > 0 && $_SESSION["glpiactiveprofile"]["interface"] != "helpdesk") {
                $options2['criteria'][0]['field'] = 4;
                // users_id
                $options2['criteria'][0]['searchtype'] = 'equals';
                $options2['criteria'][0]['value'] = $options["_users_id_" . $typename];
                $options2['criteria'][0]['link'] = 'AND';
                $options2['criteria'][1]['field'] = 12;
                // status
                $options2['criteria'][1]['searchtype'] = 'equals';
                $options2['criteria'][1]['value'] = 'notold';
                $options2['criteria'][1]['link'] = 'AND';
                $options2['reset'] = 'reset';
                $url = $this->getSearchURL() . "?" . Toolbox::append_params($options2, '&');
                echo "&nbsp;<a href='{$url}' title=\"" . __s('Processing') . "\" target='_blank'>(";
                printf(__('%1$s: %2$s'), __('Processing'), $this->countActiveObjectsForUser($options["_users_id_" . $typename]));
                echo ")</a>";
            }
            // Display active tickets for a tech
            // Need to update information on dropdown changes
            if ($type == CommonITILActor::ASSIGN) {
                echo "<span id='countassign_{$rand}'>";
                echo "</span>";
                echo "<script type='text/javascript'>";
                Ajax::updateItemJsCode("countassign_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", array('users_id_assign' => '__VALUE__'), "dropdown__users_id_" . $typename . $rand);
                echo "</script>";
            }
        }
        if ($CFG_GLPI['use_mailing']) {
            echo "<div id='notif_" . $typename . "_{$rand}'>";
            echo "</div>";
            echo "<script type='text/javascript'>";
            Ajax::updateItemJsCode("notif_" . $typename . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", $paramscomment, "dropdown_" . $actor_name . $rand);
            echo "</script>";
        }
        return $rand;
    }
CommonITILObject