Merge branch 'master' of github.com:alchemy-fr/Phraseanet

This commit is contained in:
jygaulier
2012-01-02 11:54:57 +01:00
60 changed files with 1508 additions and 657 deletions

View File

@@ -894,6 +894,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
return $this->is_template;
}
public function get_template_owner()
{
return $this->template_owner;
}
public static function get_usr_id_from_email($email)
{
if(is_null($email))

View File

@@ -88,6 +88,11 @@ class User_Query implements User_QueryInterface
* @var boolean
*/
protected $include_templates = false;
/**
*
* @var boolean
*/
protected $only_templates = false;
/**
*
* @var Array
@@ -123,10 +128,10 @@ class User_Query implements User_QueryInterface
const SORT_FIRSTNAME= 'usr_prenom';
const SORT_LASTNAME= 'usr_nom';
const SORT_COMPANY = 'societe';
const SORT_LOGIN = 'login';
const SORT_LOGIN = 'usr_login';
const SORT_EMAIL = 'usr_mail';
const SORT_ID = 'usr_id';
const SORT_CREATIONDATE = 'creationdate';
const SORT_CREATIONDATE = 'usr_creationdate';
const SORT_COUNTRY = 'pays';
const SORT_LASTMODEL = 'lastModel';
@@ -191,18 +196,22 @@ class User_Query implements User_QueryInterface
$sql .= ' AND usr_login NOT LIKE "(#deleted_%" ';
if ($this->include_invite)
if (!$this->include_invite)
{
$sql .= ' AND usr.invite=0 ';
}
if ($this->include_templates === false)
if ($this->only_templates === true)
{
$sql .= ' AND model_of = ' . $session->get_usr_id();
}
elseif ($this->include_templates === false)
{
$sql .= ' AND model_of=0';
}
else
{
$sql .= ' AND (model_of=0 OR model_of= ' . $session->get_usr_id() . ' ) ';
$sql .= ' AND (model_of=0 OR model_of = ' . $session->get_usr_id() . ' ) ';
}
$baslist = array();
@@ -355,6 +364,17 @@ class User_Query implements User_QueryInterface
return $this;
}
/**
*
* @param boolean $boolean
* @return User_Query
*/
public function only_templates($boolean)
{
$this->only_templates = !!$boolean;
return $this;
}
/**
*
@@ -390,6 +410,8 @@ class User_Query implements User_QueryInterface
case self::SORT_COMPANY:
case self::SORT_LOGIN:
case self::SORT_EMAIL:
$sorter[$k] = ' usr.`' . $sort . '` COLLATE utf8_unicode_ci ';
break;
case self::SORT_ID:
case self::SORT_CREATIONDATE:
case self::SORT_COUNTRY:
@@ -410,7 +432,7 @@ class User_Query implements User_QueryInterface
$sorter[$k] .= ' ASC ';
break;
case self::ORD_DESC:
$sorter[$k] .= ' ASC ';
$sorter[$k] .= ' DESC ';
break;
}
}