예제 #1
0
파일: view.html.php 프로젝트: smhnaji/sdnet
 /**
  * Display the view
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     TestyourselfHelper::addSubmenu('questions');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #2
0
 public static function saveHistory($data, $updateLast = false)
 {
     require_once JPATH_COMPONENT . '/helpers/testyourself.php';
     $arzi = TestyourselfHelper::arziCalc($data['question'], $data['id']);
     $arzi = $arzi[0];
     $db = JFactory::getDbo();
     if ($updateLast) {
         $query = $db->getQuery(true)->select('created, modified')->from($db->quoteName('#__testyourself_tests'))->where($db->quoteName('id') . ' = ' . $data['id']);
         $db->setQuery($query);
         $lastTest = $db->loadObject();
         $date = $lastTest->modified ? $lastTest->modified : $lastTest->created;
     } else {
         $date = JFactory::getDate()->toSql();
     }
     $query = "INSERT INTO #__testyourself_history (testsid,created,safra,dam,balgham,soda) VALUES (" . $data['id'] . ",'" . $date . "'," . $arzi['SAFRA'] . "," . $arzi['DAM'] . "," . $arzi['BALGHAM'] . "," . $arzi['SODA'] . ") ON DUPLICATE KEY UPDATE safra = " . $arzi['SAFRA'] . ", dam = " . $arzi['DAM'] . ", balgham = " . $arzi['BALGHAM'] . ", soda = " . $arzi['SODA'] . "";
     $db->setQuery($query);
     return $db->execute();
 }
예제 #3
0
파일: default.php 프로젝트: smhnaji/sdnet
		<input type="hidden" name="task" value="testyourself.submit" />
		<input type="hidden" name="option" value="com_testyourself" />
		<input type="hidden" name="return" value="<?php 
    echo $this->return_page;
    ?>
" />
		<?php 
    echo JHtml::_('form.token');
    ?>
	</form>
	<?php 
} else {
    ?>
	<?php 
    require_once JPATH_COMPONENT . '/helpers/testyourself.php';
    $result = TestyourselfHelper::testYourself($this->item);
    ?>
	<div id="result">
		<div class="row-fluid">
			<div class="span4">
				<table class="table table-bordered table-striped table-hover">
					<tr>
						<td class="text-info" width="50%"><?php 
    echo JText::_('COM_TESTYOURSELF_RESULT_BMI');
    ?>
</td>
						<td id="bmi"><?php 
    echo $result->bmi;
    ?>
</td>
					</tr>