/**
  * Method to remove venues
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($pks = array())
 {
     $result = false;
     if (count($pks)) {
         //JArrayHelper::toInteger($cid);
         $cids = implode(',', $pks);
         /*
         $query="SELECT id FROM #__joomleague_club WHERE standard_playground IN ($cids)";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult())
         {
         	$this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_VENUE_MODEL_ERROR_CLUB_EXISTS'));
         	return false;
         }
         */
         $query = "SELECT id FROM #__joomleague_project_team WHERE standard_playground IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_VENUE_MODEL_ERROR_P_TEAM_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_match WHERE playground_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_VENUE_MODEL_ERROR_MATCH_EXISTS'));
             return false;
         }
         return parent::delete($pks);
     }
     return true;
 }
 /**
  * Method to remove an event
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($cid = array())
 {
     $result = false;
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         // first check that it not used in any match events
         $query = ' SELECT ms.id ' . ' FROM #__joomleague_match_statistic AS ms ' . ' WHERE ms.statistic_id IN (' . implode(',', $cid) . ')';
         $this->_db->setQuery($query);
         $this->_db->query();
         if ($this->_db->getAffectedRows()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_STATISTIC_MODEL_CANT_DELETE_STATS_MATCHES'));
             return false;
         }
         // then check that it is not assigned to positions
         $query = ' SELECT id ' . ' FROM #__joomleague_position_statistic ' . ' WHERE statistic_id IN (' . implode(',', $cid) . ')';
         $this->_db->setQuery($query);
         $this->_db->query();
         if ($this->_db->getAffectedRows()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_STATISTIC_MODEL_CANT_DELETE_STATS_MATCHES'));
             return false;
         }
         return parent::delete($cids);
     }
     return true;
 }
 /**
  * Method to remove a club
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($pks = array())
 {
     $mainframe =& JFactory::getApplication();
     $result = false;
     if (count($pks)) {
         //JArrayHelper::toInteger($cid);
         $cids = implode(',', $pks);
         $mainframe->enqueueMessage(JText::_('JoomleagueModelClub-delete id->' . $cids), 'Notice');
         $query = "SELECT id FROM #__joomleague_team WHERE club_id IN ({$cids})";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_CLUB_MODEL_ERROR_TEAM_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_playground WHERE club_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_CLUB_MODEL_ERROR_VENUE_EXISTS'));
             return false;
         }
         return parent::delete($pks);
     }
     return true;
 }
Beispiel #4
0
 /**
  * Method to load content template data
  *
  * @access	private
  * @return	boolean	True on success
  */
 function _loadData()
 {
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $this->_data = parent::getItem($this->_id);
         return (bool) $this->_data;
     }
     return true;
 }
 function getState($property = null)
 {
     static $set;
     if (!$set) {
         $folder = JRequest::getVar('folder');
         $this->setState('folder', $folder);
         $set = true;
     }
     return parent::getState($property);
 }
 /**
  * Method to remove a league
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($cid = array())
 {
     $result = false;
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         $query = "SELECT id FROM #__joomleague_countries WHERE league_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_LEAGUE_MODEL_ERROR_PROJECT_EXISTS'));
             return false;
         }
         return parent::delete($cids);
     }
     return true;
 }
 /**
  * Method to remove a league
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($pks = array())
 {
     $mainframe =& JFactory::getApplication();
     $result = false;
     if (count($pks)) {
         //JArrayHelper::toInteger($cid);
         $cids = implode(',', $pks);
         $mainframe->enqueueMessage(JText::_('JoomleagueModelLeague-delete id->' . $cids), 'Notice');
         $query = "SELECT id FROM #__joomleague_project WHERE league_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_LEAGUE_MODEL_ERROR_PROJECT_EXISTS'));
             return false;
         }
         return parent::delete($pks);
     }
     return true;
 }
 /**
  * Method to remove a division
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($cid = array())
 {
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         $query = "UPDATE #__joomleague_project_team SET division_id=0 WHERE division_id IN ({$cids})";
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $query = "UPDATE #__joomleague_treeto SET division_id=0 WHERE division_id IN ({$cids})";
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         return parent::delete($cids);
     }
     return true;
 }
 /**
  * Method to remove a matchday
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function deleteMatches($cid = array(), $mdlMatches, $mdlMatch, $onlyMatches = false)
 {
     $result = false;
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         for ($r = 0; $r < count($cid); $r++) {
             //echo "Deleting Round: ".$cid[$r]."<br>";
             $matches = $mdlMatches->getMatchesByRound($cid[$r]);
             $matchids = array();
             for ($m = 0; $m < count($matches); $m++) {
                 $matchids[] = $matches[$m]->id;
                 //echo "  Deleting Match: ".$matches[$m]->id."<br>";
             }
             $mdlMatch->delete($matchids);
         }
         if (!$onlyMatches) {
             return parent::delete($cids);
         }
     }
     return true;
 }
 /**
  * Method to remove a sportstype
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($pks = array())
 {
     $mainframe =& JFactory::getApplication();
     $result = false;
     if (count($pks)) {
         //JArrayHelper::toInteger($pks);
         $cids = implode(',', $pks);
         $mainframe->enqueueMessage(JText::_('JoomleagueModelSportsType-delete id->' . $cids), 'Notice');
         $query = "SELECT COUNT(id) FROM #__joomleague_sports_type";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult() == count($cid)) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_SPORTTYPE_MODEL_ERROR_LAST_SPORTSTYPE'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_eventtype WHERE sports_type_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_SPORTTYPE_MODEL_ERROR_EVENT_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_position WHERE sports_type_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_SPORTTYPE_MODEL_ERROR_POSITION_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_project WHERE sports_type_id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_SPORTTYPE_MODEL_ERROR_PROJECT_EXISTS'));
             return false;
         }
         return parent::delete($pks);
     }
     return true;
 }
Beispiel #11
0
 function delete(&$pks = array())
 {
     if (count($pks)) {
         $cids = implode(',', $pks);
         $query = ' DELETE tt, ttn, ttm ';
         $query .= ' FROM #__joomleague_treeto AS tt ';
         $query .= ' LEFT JOIN #__joomleague_treeto_node AS ttn ON ttn.treeto_id=tt.id ';
         $query .= ' LEFT JOIN #__joomleague_treeto_match AS ttm ON ttm.node_id=ttn.id ';
         $query .= ' WHERE tt.id IN (' . $cids . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->execute()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         return parent::delete($pks);
     }
     return true;
 }
Beispiel #12
0
 /**
  * Save match details from modal window
  *
  * @param array $data
  * @return boolean
  */
 function savedetails($data)
 {
     if (!$data['id']) {
         $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_MATCH_ID_IS_NULL'));
         return false;
     }
     if ($data["new_match_id"] > 0) {
         $table = $this->getTable();
         if (!$table->load($data['new_match_id'])) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_OLD_GAME_NOT_FOUND'));
             return false;
         }
         $newdata = array();
         $newdata["old_match_id"] = $data["id"];
         // Bind the form fields to the table row
         if (!$table->bind($newdata)) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_BINDING_FAILED'));
             return false;
         }
         if (!$table->check()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_CHECK_FAILED'));
             return false;
         }
         if (!$table->store(true)) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_STORE_FAILED'));
             return false;
         }
     }
     if ($data["old_match_id"] > 0) {
         $table = $this->getTable();
         if (!$table->load($data['old_match_id'])) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_OLD_GAME_NOT_FOUND'));
             return false;
         }
         $newdata = array();
         $newdata["new_match_id"] = $data["id"];
         // Bind the form fields to the table row
         if (!$table->bind($newdata)) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_BINDING_FAILED'));
             return false;
         }
         if (!$table->check()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_CHECK_FAILED'));
             return false;
         }
         if (!$table->store(true)) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_MATCH_MODEL_STORE_FAILED'));
             return false;
         }
     }
     return parent::save($data);
 }
    /**
     * Method to remove an event
     *
     * @access	public
     * @return	boolean	True on success
     * @since	0.1
     */
    function delete($cid = array())
    {
        $result = false;
        if (count($cid)) {
            JArrayHelper::toInteger($cid);
            $cids = implode(',', $cid);
            // first check that they are not used in any match events
            $query = '	SELECT event_type_id
						FROM #__joomleague_match_event
						WHERE event_type_id IN (' . implode(',', $cid) . ')';
            $this->_db->setQuery($query);
            $this->_db->query();
            if ($this->_db->getAffectedRows()) {
                $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_EVENT_MODEL_ERROR_MATCHES_EXISTS'));
                return false;
            }
            // then check that they are not assigned to any positions
            $query = '	SELECT eventtype_id
						FROM #__joomleague_position_eventtype
						WHERE eventtype_id IN (' . implode(',', $cid) . ')';
            $this->_db->setQuery($query);
            $this->_db->query();
            if ($this->_db->getAffectedRows()) {
                $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_EVENT_MODEL_ERROR_POSITION_EXISTS'));
                return false;
            }
            return parent::delete($cids);
        }
        return true;
    }
 /**
  * Method to remove a person
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($pks = array())
 {
     $mainframe =& JFactory::getApplication();
     $result = false;
     if (count($pks)) {
         //JArrayHelper::toInteger($cid);
         $cids = implode(',', $pks);
         //First select all subpersons of the selected ids
         $mainframe->enqueueMessage(JText::_('JoomleagueModelPerson-delete id->' . $cids), 'Notice');
         $query = "SELECT * FROM #__joomleague_person WHERE id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($results = $this->_db->loadObjectList()) {
             foreach ($results as $result) {
                 //Now delete all match-persons assigned as player to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_event\n\t\t\t\t\t\t\t\tWHERE teamplayer_id in (select id from #__joomleague_team_player where person_id = " . $result->id . ")\n\t\t\t\t\t\t\t\t\tOR teamplayer_id2 in (select id from #__joomleague_team_player where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all match-events assigned as referee to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_referee\n\t\t\t\t\t\t\t\tWHERE project_referee_id in (select id from #__joomleague_project_referee where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all match-events assigned as player1 to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_player\n\t\t\t\t\t\t\t\tWHERE teamplayer_id in (select id from #__joomleague_team_player where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all match-events assigned as player2 to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_staff\n\t\t\t\t\t\t\t\tWHERE team_staff_id in (select id from #__joomleague_team_staff where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 $query = "DELETE FROM #__joomleague_match_statistic\n\t\t\t\t\t\t\t\tWHERE teamplayer_id in (select id from #__joomleague_team_player where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 $query = "DELETE FROM #__joomleague_match_staff_statistic\n\t\t\t\t\t\t\t\tWHERE team_staff_id in (select id from #__joomleague_team_staff where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all person assigned as referee in a project of the selected ids
                 $query = "DELETE FROM #__joomleague_project_referee\n\t\t\t\t\t\t\t\tWHERE person_id=" . $result->id;
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all person assigned as player in a team of the selected ids
                 $query = "DELETE FROM #__joomleague_team_player\n\t\t\t\t\t\t\t\tWHERE person_id=" . $result->id;
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all person assigned as staff in a team of the selected ids
                 $query = "DELETE FROM #__joomleague_team_staff\n\t\t\t\t\t\t\t\tWHERE person_id=" . $result->id;
                 $this->_db->setQuery($query);
                 if (!$this->_db->query()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
             }
         }
         return parent::delete($pks);
     }
     return true;
 }
Beispiel #15
0
 /**
  * Method to remove a person
  *
  * @access	public
  * @return	boolean	True on success
  */
 function delete(&$pks = array())
 {
     if (count($pks)) {
         $cids = implode(',', $pks);
         //First select all subpersons of the selected ids
         $query = "SELECT * FROM #__joomleague_person WHERE id IN ({$cids})";
         $this->_db->setQuery($query);
         if ($results = $this->_db->loadObjectList()) {
             foreach ($results as $result) {
                 //Now delete all match-persons assigned as player to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_event\n\t\t\t\t\t\t\t\tWHERE teamplayer_id in (select id from #__joomleague_team_player where person_id = " . $result->id . ")\n\t\t\t\t\t\t\t\t\tOR teamplayer_id2 in (select id from #__joomleague_team_player where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all match-events assigned as referee to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_referee\n\t\t\t\t\t\t\t\tWHERE project_referee_id in (select id from #__joomleague_project_referee where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all match-events assigned as player1 to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_player\n\t\t\t\t\t\t\t\tWHERE teamplayer_id in (select id from #__joomleague_team_player where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all match-events assigned as player2 to subpersons of the selected ids
                 $query = "DELETE FROM #__joomleague_match_staff\n\t\t\t\t\t\t\t\tWHERE team_staff_id in (select id from #__joomleague_team_staff where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 $query = "DELETE FROM #__joomleague_match_statistic\n\t\t\t\t\t\t\t\tWHERE teamplayer_id in (select id from #__joomleague_team_player where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 $query = "DELETE FROM #__joomleague_match_staff_statistic\n\t\t\t\t\t\t\t\tWHERE team_staff_id in (select id from #__joomleague_team_staff where person_id = " . $result->id . ")";
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all person assigned as referee in a project of the selected ids
                 $query = "DELETE FROM #__joomleague_project_referee\n\t\t\t\t\t\t\t\tWHERE person_id=" . $result->id;
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all person assigned as player in a team of the selected ids
                 $query = "DELETE FROM #__joomleague_team_player\n\t\t\t\t\t\t\t\tWHERE person_id=" . $result->id;
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
                 //Now delete all person assigned as staff in a team of the selected ids
                 $query = "DELETE FROM #__joomleague_team_staff\n\t\t\t\t\t\t\t\tWHERE person_id=" . $result->id;
                 $this->_db->setQuery($query);
                 if (!$this->_db->execute()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
             }
         }
         return parent::delete($pks);
     }
     return true;
 }
 /**
  * Method to remove a position
  *
  * @access	public
  * @return	boolean	True on success
  * @since	0.1
  */
 function delete($cid = array())
 {
     $result = false;
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         $query = "SELECT pos.id FROM #__joomleague_project_position AS ppos\n              INNER JOIN #__joomleague_position AS pos ON pos.id = ppos.position_id\n              WHERE pos.id IN ({$cids})";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_POSITION_MODEL_ERROR_P_POSITION_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_project_referee AS pref \n              INNER JOIN #__joomleague_project_position AS ppos ON ppos.id = pref.project_position_id\n              INNER JOIN #__joomleague_position AS pos ON pos.id = ppos.position_id\n              WHERE pos.id IN ({$cids})";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_POSITION_MODEL_ERROR_P_REFEREE_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_team_player AS tp\n              INNER JOIN #__joomleague_project_position AS ppos ON ppos.id = tp.project_position_id\n              INNER JOIN #__joomleague_position AS pos ON pos.id = ppos.position_id\n              WHERE pos.id IN ({$cids})";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_POSITION_MODEL_ERROR_PLAYER_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_team_staff AS ts\n              INNER JOIN #__joomleague_project_position AS ppos ON ppos.id = ts.project_position_id\n              INNER JOIN #__joomleague_position AS pos ON pos.id = ppos.position_id\n              WHERE pos.position_id IN ({$cids})";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_POSITION_MODEL_ERROR_STAFF_EXISTS'));
             return false;
         }
         $query = "SELECT id FROM #__joomleague_person \n              WHERE position_id IN ({$cids})";
         //echo '<pre>'.print_r($query,true).'</pre>';
         $this->_db->setQuery($query);
         if ($this->_db->loadResult()) {
             $this->setError(JText::_('COM_JOOMLEAGUE_ADMIN_POSITION_MODEL_ERROR_PERSON_EXISTS'));
             return false;
         }
         return parent::delete($cids);
     }
     return true;
 }