function getNearbySchools($academyID, $schoolType, $X, $Y) { // TODO: on pourrait ajouter une limite à la query, mais ça ne semble pas utile. if ($schoolType == "Lycée") { $filterType = getConstraintLycees(); } else { if ($schoolType == "Collège") { $filterType = getConstraintColleges(); } else { $filterType = getConstraintCollegesLycees(); } } $query = "SELECT \n `recommend_listedschool`.appellation_officielle_uai as name,\n SUBSTRING_INDEX(`recommend_listedschool`.localite_acheminement_uai, 'CEDEX', 1) as city,\n SQRT(POW(:X - `recommend_listedschool`.X, 2) + POW(:Y - `recommend_listedschool`.Y, 2)) as distance\n FROM `recommend_listedschool` \n WHERE {$filterType} \n AND academyID = :academyID\n AND (patronyme_uai NOT LIKE '' OR appellation_officielle_uai NOT LIKE 'Collège')\n AND (appellation_officielle_uai NOT LIKE '%privé%' COLLATE utf8_general_ci)\n AND \n NOT EXISTS (SELECT * FROM `recommend_school_listedschool` \n JOIN `school_year` \n ON `school_year`.schoolID = `recommend_school_listedschool`.schoolID \n AND `school_year`.year >= 2013\n WHERE `recommend_school_listedschool`.listedschoolID = `recommend_listedschool`.ID)\n ORDER BY SQRT(POW(:X - `recommend_listedschool`.X, 2) + POW(:Y - `recommend_listedschool`.Y, 2)) "; // LIMIT 10 $stmt = getDb()->prepare($query); // $stmt->debugDumpParams(); $stmt->execute(array(':academyID' => $academyID, ':X' => $X, ':Y' => $Y)); reportErrors($stmt); $results = $stmt->fetchAll(PDO::FETCH_OBJ); if ($results === FALSE) { $results = array(); } return $results; // array of {name,city,distance} objects, ordered by distance. }
/** * PROCESS THE FORM * ================================================================== * * This function runs through the process of: * - validating the form * - sending data they supplied to you via email * - giving the user feedback when the email is sent * */ function processForm() { global $is_demo, $translations, $lang, $fdata, $options; // create an attachments directory if it doesn't exist $dir = $options['attachment_dir']; if (!file_exists($dir) && !is_dir($dir)) { mkdir($dir, 0777, true); } // Validate the form data, grab any errors // If errors exist, stop processing and tell the user $errors = getValidationErrors(); if (!empty($errors)) { reportErrors($errors); exit; } // Send the data to each email address in the options if (!$is_demo) { sendEmailToSiteOwner(); } else { emailSuccessfullySent(); } }
* @type bool Global debug flag: If true, your logs will grow large and your performance will suffer, but fruitful information will be gathered. */ const DSP_DEBUG = false; /** * @type bool Global PHP-ERROR flag: If true, PHP-ERROR will be utilized if available. See https://github.com/JosephLenton/PHP-Error for more info. */ const DSP_DEBUG_PHP_ERROR = false; $_class = 'DreamFactory\\Platform\\Yii\\Components\\Platform' . ('cli' == PHP_SAPI ? 'Console' : 'Web') . 'Application'; /** * Debug-level output based on constant value above * For production mode, you'll want to set the above constants to FALSE * Get this turned on before anything is loaded */ if (DSP_DEBUG) { ini_set('display_errors', true); ini_set('error_reporting', -1); defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3); } // Load up composer... $_autoloader = (require_once __DIR__ . '/../vendor/autoload.php'); // Load up Yii if it's not been already if (!class_exists('\\Yii', false)) { require_once __DIR__ . '/../vendor/dreamfactory/yii/framework/yiilite.php'; } // php-error utility if (DSP_DEBUG_PHP_ERROR && function_exists('reportErrors')) { reportErrors(); } // Create the application and run. This doe not return until the request is complete. Pii::run(__DIR__, $_autoloader, $_class);
function calledFunc($arg1, $arg2, $optArg = false) { reportErrors(func_get_args(), __FUNCTION__); echo 'resuming "' . __FUNCTION__ . '"<br>'; var_dump(func_get_args()); }