Ejemplo n.º 1
0
	public function _help_home() {
		global $user;
		
		$comments = new _comments();
		
		$ha = $this->auth->query('comments');
		
		if ($ha) {
			$ha_add = $this->auth->option(array('help', 'add'));
			$ha_edit = $this->auth->option(array('help', 'edit'));
			$ha_delete = $this->auth->option(array('help', 'delete'));
		}
		
		$sql = 'SELECT c.*, m.*
			FROM _help_cat c, _help_modules m
			WHERE c.help_module = m.module_id
			ORDER BY c.help_order';
		$cat = sql_rowset($sql, 'help_id');
		
		$sql = 'SELECT *
			FROM _help_faq';
		$faq = sql_rowset($sql, 'faq_id');
		
		//
		// Loop
		//
		foreach ($cat as $help_id => $cdata) {
			_style('cat', array(
				'HELP_ES' => $cdata['help_es'],
				'HELP_EN' => $cdata['help_en'],
				
				'HELP_EDIT' => s_link_control('comments', array('mode' => $this->mode)),
				'HELP_UP' => s_link_control('comments', array('mode' => $this->mode)),
				'HELP_DOWN' => s_link_control('comments', array('mode' => $this->mode)))
			);
			
			if ($ha_edit) {
				_style('cat.edit', array(
					'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'cat', 'id' => $help_id)),
					'UP' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'cat', 'id' => $help_id, 'order' => '_15')),
					'DOWN' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'cat', 'id' => $help_id, 'order' => '15')))
				);
			}
			
			if ($ha_delete) {
				_style('cat.delete', array(
					'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'delete', 'sub' => 'cat', 'id' => $help_id)))
				);
			}
			
			foreach ($faq as $faq_id => $fdata) {
				if ($help_id != $fdata['help_id']) {
					continue;
				}
				
				_style('cat.faq', array(
					'QUESTION_ES' => $fdata['faq_question_es'],
					'ANSWER_ES' => $comments->parse_message($fdata['faq_answer_es']))
				);
				
				if ($ha_edit) {
					_style('cat.faq.edit', array(
						'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'edit', 'sub' => 'faq', 'id' => $fdata['faq_id'])))
					);
				}
				
				if ($ha_delete) {
					_style('cat.faq.delete', array(
						'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'delete', 'sub' => 'faq', 'id' => $fdata['faq_id'])))
					);
				}
			}
		}
		
		if ($ha_add) {
			_style('add', array(
				'URL' => s_link_control('comments', array('mode' => $this->mode, 'manage' => 'add')))
			);
		}
		
		$this->nav();
		
		return;
	}