Example #1
0
 /** singleton SQL::getInstance() instead of new SQL */
 public static function i()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 * Jeedom is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php';
    include_file('core', 'authentification', 'php');
    if (!isConnect('admin')) {
        throw new Exception(__('401 - Accès non autorisé', __FILE__));
    }
    if (init('action') == 'cmdForDistance') {
        $return = array();
        foreach (geoloc::byType('geoloc') as $eqLogic) {
            foreach ($eqLogic->getCmd() as $cmd) {
                if ($cmd->getConfiguration('mode') != 'distance' && $cmd->getConfiguration('mode') != 'travelTime' && $cmd->getConfiguration('mode') != 'travelDistance') {
                    $infoCmd = array('id' => $cmd->getId(), 'human_name' => $cmd->getHumanName());
                    $return[] = $infoCmd;
                }
            }
        }
        ajax::success($return);
    }
    throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}