Beispiel #1
0
 /**
  * Method to add a new sportstype if not already exists
  *
  * @access	private
  * @return	boolean	True on success
  **/
 function addSportsType($newSportsTypeName)
 {
     $path = JPATH::clean(JPATH_ROOT . '/images/com_joomleague/database/events/' . JFolder::makesafe($newSportsTypeName));
     if (!JFolder::exists($path)) {
         JFolder::create($path);
     }
     // SportsType does NOT exist and has to be created
     $tblSportsType = $this->getTable();
     $tblSportsType->load(array('name' => $newSportsTypeName));
     $tblSportsType->name = $newSportsTypeName;
     $tblSportsType->store();
     return $tblSportsType->id;
 }
 /**
  * Method to add a new sportstype if not already exists
  *
  * @access	private
  * @return	boolean	True on success
  * @since	1.5
  **/
 function addSportsType($newsportstype)
 {
     //check if sportstype exists. If not add a new sportstype to table
     $query = "SELECT * FROM #__joomleague_sport_type WHERE name=" . $this->_db->Quote($newsportstype);
     $this->_db->setQuery($query);
     $sportstypeObject = $this->_db->loadObject();
     if ($sportstypeObject->id) {
         //sportstype already exists
         return $sportstypeObject->id;
     }
     JFolder::create(JPATH::clean(JPATH_ROOT . '/images/com_joomleague/database/events/' . JFolder::makesafe($name)));
     //sportstype does NOT exist and has to be created
     $p_sportstype =& $this->getTable();
     $p_sportstype->set('name', $newsportstype);
     if (!$p_sportstype->store()) {
         $sportstypeObject->id = 0;
     } else {
         $sportstypeObject->id = $this->_db->insertid();
         //mysql_insert_id();
     }
     return $sportstypeObject->id;
 }