Ejemplo n.º 1
0
 /**
  * Construct new input field for: typeid
  * @param string $name
  * @param string $label
  * @param string $value optional, default: loading from $_POST
  */
 public function __construct($name, $label, $value = '')
 {
     parent::__construct($name, $label, $value);
     $this->addOption(0, '---- ' . __('select type'), array('data-sport' => 'all'));
     foreach (TypeFactory::AllTypes() as $id => $data) {
         $this->addOption($id, $data['name'], array('data-sport' => $data['sportid']));
     }
 }
 /**
  * Construct new input field for: typeid
  * @param string $name
  * @param string $label
  * @param string $value optional, default: loading from $_POST
  */
 public function __construct($name, $label, $value = '')
 {
     parent::__construct($name, $label, $value);
     $this->addLayoutClass(TrainingFormular::$ONLY_TYPES_CLASS);
     $this->addOption(0, '---- ' . __('select type'), array('data-sport' => 'all'));
     foreach (TypeFactory::AllTypes() as $id => $data) {
         $this->addOption($id, $data['name'], array('data-sport' => $data['sportid']));
     }
 }
Ejemplo n.º 3
0
 /**
  * Init all types
  * 
  * IDs will be set as string as indices for correct order
  */
 private static function initAllTypes()
 {
     self::$AllTypes = array();
     $types = Cache::get('types');
     if (is_null($types)) {
         $types = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'type` WHERE `accountid` = ' . SessionAccountHandler::getId())->fetchAll();
         Cache::set('types', $types, '3600');
     }
     foreach ($types as $data) {
         self::$AllTypes[(string) $data['id']] = $data;
     }
     Configuration::ActivityForm()->orderTypes()->sort(self::$AllTypes);
 }
Ejemplo n.º 4
0
 /**
  * Parse all post values 
  */
 public function parsePostData()
 {
     $Types = DB::getInstance()->query('SELECT `id` FROM `' . PREFIX . 'type` WHERE `accountid` = ' . SessionAccountHandler::getId())->fetchAll();
     $Types[] = array('id' => -1);
     foreach ($Types as $Type) {
         $id = $Type['id'];
         $columns = array('name', 'abbr', 'sportid', 'short', 'hr_avg', 'quality_session');
         $values = array($_POST['type']['name'][$id], $_POST['type']['abbr'][$id], $_POST['type']['sportid'][$id], $_POST['type']['short'][$id], $_POST['type']['hr_avg'][$id], isset($_POST['type']['quality_session'][$id]));
         if (isset($_POST['type']['delete'][$id])) {
             DB::getInstance()->deleteByID('type', (int) $id);
         } elseif ($id != -1) {
             DB::getInstance()->update('type', $id, $columns, $values);
         } elseif (strlen($_POST['type']['name'][$id]) > 2) {
             DB::getInstance()->insert('type', $columns, $values);
         }
     }
     if (isset($_POST['type']['name'][$_POST['racetype']]) && !isset($_POST['type']['delete'][$_POST['racetype']]) && $_POST['type']['sportid'][$_POST['racetype']] == Configuration::General()->runningSport() && $_POST['racetype'] != Configuration::General()->competitionType()) {
         // TODO: this needs a recalculation of vdot factor
         Configuration::General()->updateCompetitionType($_POST['racetype']);
         Ajax::setReloadFlag(Ajax::$RELOAD_PLUGINS);
     }
     TypeFactory::reInitAllTypes();
     Ajax::setReloadFlag(Ajax::$RELOAD_DATABROWSER);
 }
Ejemplo n.º 5
0
 /**
  * Constructor
  * @param int $id type id
  */
 public function __construct($id)
 {
     $this->id = $id;
     $this->data = TypeFactory::DataFor($id);
 }
Ejemplo n.º 6
0
 public function AddType($typeid)
 {
     array_push($this->Types, TypeFactory::GetType($typeid));
 }
Ejemplo n.º 7
0
 /**
  * Type
  * @param int $typeid
  * @return \Runalyze\Model\Type\Object
  */
 public function type($typeid)
 {
     return new Type\Object(\TypeFactory::DataFor($typeid));
 }
Ejemplo n.º 8
0
    echo json_encode($ret_val);
});
$app->get('/testserver/', function () {
    $ret_val = array();
    require_once 'category.php';
    $category = new Category(4);
    $category->Save();
    $ret_val['success'] = 1;
    echo json_encode($ret_val);
});
//TODO
$app->get('/getblogtypelist', function () {
    require_once 'common/dbconnection.php';
    $GLOBALS['mysqli'] = MySQLConnection::Open();
    require_once 'posttype.php';
    $retval = TypeFactory::GetTypes();
    MySQLConnection::Close($GLOBALS['mysqli']);
    echo json_encode($retval);
});
$app->get('/getcategorylist/', function () {
    require_once 'common/dbconnection.php';
    $GLOBALS['mysqli'] = MySQLConnection::Open();
    require_once 'category.php';
    $retval = CategoryFactory::GetCategories();
    MySQLConnection::Close($GLOBALS['mysqli']);
    echo json_encode($retval);
});
$app->get('/getpublishedcategorylist/', function () {
    require_once 'common/dbconnection.php';
    $GLOBALS['mysqli'] = MySQLConnection::Open();
    require_once 'category.php';