<?php
/**
 * unit_goal.php - Manage unit goal data and UI.
 *
 * *** FILE IS OBSOLETE ***
 *
 * @author $Author: dtong $
 * @version $Id: unit_goal.php,v 1.11 2011/04/19 04:04:47 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
echo "unit_goal.php is obsolete.";
exit;
require_once ('unit_buttons.php');
class unit_goal extends unit_base {
	private $buttonsobj=NULL;

	function __construct () {
		parent::__construct();
		$this->CI->load->model('goal/goal_model');
	}

	function render($data, $params) {
		$this->buttonsobj = new unit_buttons();
		if ( $data !== FALSE && $params !== FALSE ) {
			$this->reset($data, $params);
		}
		if (!isset($data['_typeid']) || $data['_typeid'] == FALSE)
			return;
		$typeid = $data['_typeid'];
		$linkunit = $this->CI->goal_model->get_linkunit_all($this->params->unitid,$typeid);
		if ( $linkunit !== FALSE){
			foreach ($linkunit as $value){
				$class = $this->color_track('listitem1', 'listitem2');
				$this->html .= "<table class=\"{$class}\" border='0' >";
				$this->html .= "<tr ><td  class=\"itemtext\">";
				$lnk_url = 	base_url() . 'unit/unit/read_bygroupid/'.$value->groupid;
				$this->html .= $data['_link_title'];
				$this->html .= "<a class=\"cmslink\" href=\"$lnk_url\" onclick=\"newDhtmlWindow('$lnk_url','" . lang('unit_copy_col_unit') .
									"',900,800,'unitread');return false;\">{$value->title}</a>";
				$this->html .= '&nbsp;<span class="linkunit">('.$value->coursename.')</span>';
				$this->html .= '<td valign="middle" align="right" class="itembuttons">';
					//Buttons
				if ( is_array($buttons = $this->getval('_button_linkunit')) ) {
					$this->html .= '<td valign="middle" align="right" class="itembuttons">';
					$params->resid = $value->groupid; //assign the resource id
					$this->html .= $this->buttonsobj->render($buttons, $params);
					$this->html .= '</td>';
				}//Buttons
				$this->html .= "</td></tr>";
				$this->html .= "</table>";
			}
		}

		return $this->html;
	}
}
?>