Merge branch 'templates' into 3.6

This commit is contained in:
Romain Neutron
2012-01-06 18:14:22 +01:00
3 changed files with 35 additions and 39 deletions

View File

@@ -1117,8 +1117,14 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function set_last_template(User_Interface $template)
{
$sql = 'UPDATE usr SET lastModel = :template_id WHERE usr_id = :usr_id';
$params = array(
':usr_id' => $this->get_id()
, ':template_id' => $template->get_login()
);
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':usr_id' => $this->get_id(), ':template_id' => $template->get_id()));
$stmt->execute($params);
$stmt->closeCursor();
$this->delete_data_from_cache();
@@ -1249,18 +1255,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_applied_template()
{
$template = '';
if ($this->applied_template)
{
$sql = 'SELECT usr_login FROM usr WHERE usr_login = :login';
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':login' => $this->applied_template));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$template = $row['usr_login'];
}
return $template;
return $this->applied_template;
}
public function get_creation_date()
@@ -1281,7 +1277,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected function load_preferences()
{
if ($this->_prefs)
return $this;
$sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id';
$stmt = $this->appbox->get_connection()->prepare($sql);
@@ -1519,7 +1514,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$appbox = appbox::get_instance();
$session = $appbox->get_session();
if (!$session->is_authenticated())
return;
$ses_id = $session->get_ses_id();
@@ -1794,7 +1788,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_nonce()
{
if ($this->nonce)
return $this->nonce;
$nonce = false;
@@ -1812,7 +1805,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
return $this->nonce;
}
public function __sleep()
{
$vars = array();

View File

@@ -151,10 +151,14 @@
{% for usr in users.get_results %}
<tr class="{% if loop.index is odd %}odd{% else %}even{% endif %}" id="user_{{usr.get_id()}}">
<td style="text-align: center;">
{% if usr.is_template() %}
<img title="{% trans 'This is a template' %}" src="/skins/icons/template.png"/>
{% else %}
{% if usr.ACL().is_phantom() %}
<img src="/skins/admin/ghost.png"/>
<img title="{% trans 'This user has no rights' %}" src="/skins/admin/ghost.png"/>
{% endif %}
{{usr.get_id()}}
{% endif %}
</td>
<td>
{{usr.get_login()}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB