Add a method to get an icon for a record, as specific to that record as possible

This commit is contained in:
Nathan Gray 2014-11-18 23:40:49 +00:00
parent 08708664b3
commit ea8ff86854
9 changed files with 116 additions and 9 deletions

View File

@ -8,7 +8,7 @@
* @link http://www.egroupware.org
* @author Cornelius Weiss <nelius@cwtech.de>
* @copyright Cornelius Weiss <nelius@cwtech.de>
* @version $Id: class.egw_addressbook_record.inc.php 22827 2006-11-10 15:35:35Z nelius_weiss $
* @version $Id$
*/
/**
@ -105,6 +105,21 @@ class addressbook_egw_record implements importexport_iface_egw_record
return $this->identifier ? $this->identifier : $this->id;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
$ui = new addressbook_ui();
// Type as default
$ui->type_icon($this->owner, $this->private, $this->tid, $icon, $label);
// Specific photo
return $this->jpegphoto ? egw_framework::link('/index.php',$ui->photo_src($this->identifier,$this->jpegphoto)):'addressbook/'.$icon;
}
/**
* saves record into backend
*

View File

@ -104,6 +104,16 @@ class admin_egw_group_record implements importexport_iface_egw_record
return $this->identifier;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
return 'group';
}
/**
* saves record into backend
*

View File

@ -105,6 +105,16 @@ class admin_egw_user_record implements importexport_iface_egw_record
return $this->identifier;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
return 'user';
}
/**
* saves record into backend
*

View File

@ -108,6 +108,16 @@ class calendar_egw_record implements importexport_iface_egw_record
return $this->identifier;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
return 'calendar/navbar';
}
/**
* saves record into backend
*

View File

@ -257,6 +257,16 @@ class importexport_definition implements importexport_iface_egw_record {
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
return self::_appname . '/navbar';
}
/**
* saves record into backend
*

View File

@ -14,11 +14,11 @@
* class importexport_iface_egw_record
* This a the abstract interface of an egw record.
* A record is e.g. a single address or or single event.
* The idea behind is that we can have metaoperation over differnt apps by
* The idea behind is that we can have metaoperation over differnt apps by
* having a common interface.
* A record is identified by a identifier. As we are a Webapp and want to
* A record is identified by a identifier. As we are a Webapp and want to
* deal with the objects in the browser, identifier should be a string!
*
*
* @todo lots! of discussion with other developers
* @todo move to api once developers accepted it!
* @todo functions for capabilities of object
@ -51,7 +51,7 @@ interface importexport_iface_egw_record
public function __set($_attribute_name, $data);
/**
* converts this object to array.
* converts this object to array.
* @abstract We need such a function cause PHP5
* dosn't allow objects do define it's own casts :-(
* once PHP can deal with object casts we will change to them!
@ -62,7 +62,7 @@ interface importexport_iface_egw_record
/**
* gets title of record
*
*
*@return string tiltle
*/
public function get_title();
@ -80,11 +80,18 @@ interface importexport_iface_egw_record
* @return string identifier of this record
*/
public function get_identifier();
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon();
/**
* saves record into backend
*
*
* @return string identifier
*/
public function save ( $_dst_identifier );
@ -109,7 +116,7 @@ interface importexport_iface_egw_record
/**
* delets current record from backend
* @return void
*
*
*/
public function delete ();

View File

@ -108,6 +108,26 @@ class infolog_egw_record implements importexport_iface_egw_record
return $this->identifier;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
$icon = 'infolog/navbar';
$ui = new infolog_ui();
if (!($icon = $ui->icons['type'][$this->info_type]))
{
$icon = $ui->icons['status'][$this->info_status];
}
if (!$icon)
{
$icon = 'navbar';
}
return 'infolog/'.$icon;
}
/**
* saves record into backend
*

View File

@ -103,6 +103,21 @@ class resources_egw_record implements importexport_iface_egw_record
return $this->identifier;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
$bo = new resources_bo();
if(!$icon = $bo->get_picture($this->identifier,$this->picture_src))
{
$icon = 'resources/navbar';
}
return $icon;
}
/**
* saves record into backend
*

View File

@ -116,6 +116,16 @@ class timesheet_egw_record implements importexport_iface_egw_record
return $this->identifier;
}
/**
* Gets the URL icon representitive of the record
* This could be as general as the application icon, or as specific as a contact photo
*
* @return string Full URL of an icon, or appname/icon_name
*/
public function get_icon() {
return 'timesheet/navbar';
}
/**
* saves record into backend
*