<commit_before><?php
/**
 * Created by PhpStorm.
 * User: dimaninc
 * Date: 08.06.2015
 * Time: 17:11
 */
/**
 * Class diAdminModel
 * Methods list for IDE
 *
 * @method string	getLogin
 * @method string	getPassword
 * @method string	getFirstName
 * @method string	getLastName
 * @method string	getEmail
 * @method string	getPhone
 * @method string	getHost
 * @method string	getLevel
 * @method integer	getActive
 * @method string	getDate
 * @method integer	getIp
 *
 * @method bool hasLogin
 * @method bool hasPassword
 * @method bool hasFirstName
 * @method bool hasLastName
 * @method bool hasEmail
 * @method bool hasPhone
 * @method bool hasHost
 * @method bool hasLevel
 * @method bool hasActive
 * @method bool hasDate
 * @method bool hasIp
 *
 * @method diAdminModel setLogin($value)
 * @method diAdminModel setPassword($value)
 * @method diAdminModel setFirstName($value)
 * @method diAdminModel setLastName($value)
 * @method diAdminModel setEmail($value)
 * @method diAdminModel setPhone($value)
 * @method diAdminModel setHost($value)
 * @method diAdminModel setLevel($value)
 * @method diAdminModel setActive($value)
 * @method diAdminModel setDate($value)
 * @method diAdminModel setIp($value)
 */
class diAdminModel extends diBaseUserModel
{
	const COMPLEX_QUERY_PREFIX = 'admin_';

	const type = diTypes::admin;
	protected $table = "admins";
	protected $slugFieldName = "login";

	protected $fields = [
		'login',
		'password',
		'first_name',
		'last_name',
		'email',
		'phone',
		'host',
		'level',
		'active',
		'date',
		'ip',
	];

	public function getTemplateVars()
	{
		$ar = parent::getTemplateVars();

		$ar["level_str"] = $this->getLevelStr();
		$ar["name"] = sprintf("%s %s", $this->getFirstName(), $this->getLastName());

		return $ar;
	}

	protected function getLevelStr()
	{
		if (!$this->exists())
		{
			return null;
		}

		if (class_exists("diAdminsCustomPage"))
		{
			$levelsAr = diAdminsCustomPage::$levelsAr;
		}
		else
		{
			$levelsAr = diAdminsPage::$levelsAr;
		}

		$levelsAr = array_merge(diAdminsPage::$baseLevelsAr, $levelsAr);

		$levelsAr = diAdminsPage::translateLevels($levelsAr, $this->__getLanguage());

		return isset($levelsAr[$this->getLevel()]) ? $levelsAr[$this->getLevel()] : '---';
	}
}<commit_msg>admin model: level titles update<commit_after><?php
/**
 * Created by PhpStorm.
 * User: dimaninc
 * Date: 08.06.2015
 * Time: 17:11
 */
/**
 * Class diAdminModel
 * Methods list for IDE
 *
 * @method string	getLogin
 * @method string	getPassword
 * @method string	getFirstName
 * @method string	getLastName
 * @method string	getEmail
 * @method string	getPhone
 * @method string	getHost
 * @method string	getLevel
 * @method integer	getActive
 * @method string	getDate
 * @method integer	getIp
 *
 * @method bool hasLogin
 * @method bool hasPassword
 * @method bool hasFirstName
 * @method bool hasLastName
 * @method bool hasEmail
 * @method bool hasPhone
 * @method bool hasHost
 * @method bool hasLevel
 * @method bool hasActive
 * @method bool hasDate
 * @method bool hasIp
 *
 * @method diAdminModel setLogin($value)
 * @method diAdminModel setPassword($value)
 * @method diAdminModel setFirstName($value)
 * @method diAdminModel setLastName($value)
 * @method diAdminModel setEmail($value)
 * @method diAdminModel setPhone($value)
 * @method diAdminModel setHost($value)
 * @method diAdminModel setLevel($value)
 * @method diAdminModel setActive($value)
 * @method diAdminModel setDate($value)
 * @method diAdminModel setIp($value)
 */
class diAdminModel extends diBaseUserModel
{
	const COMPLEX_QUERY_PREFIX = 'admin_';

	const type = diTypes::admin;
	protected $table = "admins";
	protected $slugFieldName = "login";

	protected $fields = [
		'login',
		'password',
		'first_name',
		'last_name',
		'email',
		'phone',
		'host',
		'level',
		'active',
		'date',
		'ip',
	];

	public function getTemplateVars()
	{
		$ar = parent::getTemplateVars();

		$ar["level_str"] = $this->getLevelStr();
		$ar["name"] = sprintf("%s %s", $this->getFirstName(), $this->getLastName());

		return $ar;
	}

	protected function getLevelStr()
	{
		if (!$this->exists())
		{
			return null;
		}

		/** @var \diAdminsPage $adminPageClassName */
		$adminPageClassName = \diLib::getClassNameFor('admins', \diLib::ADMIN_PAGE);

		if (class_exists($adminPageClassName))
		{
			$levelsAr = $adminPageClassName::$levelsAr;
		}
		else
		{
			$levelsAr = \diAdminsPage::$levelsAr;
		}

		$levelsAr = array_merge(\diAdminsPage::$baseLevelsAr, $levelsAr);

		$levelsAr = \diAdminsPage::translateLevels($levelsAr, $this->__getLanguage());

		return isset($levelsAr[$this->getLevel()]) ? $levelsAr[$this->getLevel()] : '---';
	}
}
{'fraction_non_alphanumeric': 0.145002145002145, 'fraction_numerical': 0.005148005148005148, 'mean_word_length': 4.624849215922799, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6930866', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1564, 'n_words': 372}