* only set image size when view a todo.

This commit is contained in:
wangchunsheng
2012-04-30 06:32:12 +00:00
parent 25e1a79e83
commit 591f918a98
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ class todo extends control
* Construct function, load model of task, bug, my.
*
* @access public
* @return voidzentaoms\www
* @return void
*/
public function __construct()
{
@@ -133,7 +133,7 @@ class todo extends control
*/
public function view($todoID, $from = 'company')
{
$todo = $this->todo->getById($todoID);
$todo = $this->todo->getById($todoID, true);
if(!$todo) die(js::error($this->lang->notFound) . js::locate('back'));
/* Save the session. */
+3 -2
View File
@@ -143,14 +143,15 @@ class todoModel extends model
* Get info of a todo.
*
* @param int $todoID
* @param bool $setImgSize
* @access public
* @return object|bool
*/
public function getById($todoID)
public function getById($todoID, $setImgSize = false)
{
$todo = $this->dao->findById((int)$todoID)->from(TABLE_TODO)->fetch();
if(!$todo) return false;
$todo->desc = $this->loadModel('file')->setImgSize($todo->desc);
if($setImgSize) $todo->desc = $this->loadModel('file')->setImgSize($todo->desc);
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
$todo->date = str_replace('-', '', $todo->date);