KnowbaseItem::prepareInputForAdd PHP Method

prepareInputForAdd() public method

See also: CommonDBTM::prepareInputForAdd()
public prepareInputForAdd ( $input )
    function prepareInputForAdd($input)
    {
        // set new date if not exists
        if (!isset($input["date"]) || empty($input["date"])) {
            $input["date"] = $_SESSION["glpi_currenttime"];
        }
        // set users_id
        // set title for question if empty
        if (isset($input["name"]) && empty($input["name"])) {
            $input["name"] = __('New item');
        }
        if (Session::haveRight(self::$rightname, self::PUBLISHFAQ) && !Session::haveRight(self::$rightname, UPDATE)) {
            $input["is_faq"] = 1;
        }
        if (!Session::haveRight(self::$rightname, self::PUBLISHFAQ) && Session::haveRight(self::$rightname, UPDATE)) {
            $input["is_faq"] = 0;
        }
        return $input;
    }