示例#1
0
function getAvailableSourceType($config, $includeDisabled, $id_account)
{
    $aTypes = null;
    $mg = mg_connect($config, "", "", "");
    if ($mg) {
        if ($includeDisabled) {
            $query = array('$and' => array('$or' => array(array("deleted" => "0"), array("deleted" => NULL))), array("id_account" => intval($id_account)));
        } else {
            $query = array('$and' => array(array('$or' => array(array("deleted" => "0"), array("deleted" => NULL))), array("enabled" => "1"), array("id_account" => intval($id_account))));
        }
        $stmt = new mg_stmt_distinct($mg, "sources");
        $stmt->setQuery($query);
        $stmt->setKey("type");
        $aTypes = $stmt->command();
    }
    return $aTypes;
}
     $res2 .= "Show only sources from this country</td><td><select id='filter_country' name='filter_country' style='editInputSelect' onChange='loadSources(\"" . $start . "\", 1);'>";
     $res2 .= "<option value=''>any</option>";
     for ($j = 0; $j <= count($aCountry); $j++) {
         $c = trim(strtoupper($aCountry[$j]));
         if (!empty($c)) {
             $res2 .= "<option value='" . $c . "'";
             if ($filter_country == $c) {
                 $res2 .= " selected";
             }
             $res2 .= ">" . str_replace("_", " ", $aCountries[$c]) . "</option>";
         }
     }
     $res2 .= "</select></td></tr>";
 }
 $stmt = new mg_stmt_distinct($mg, "sources");
 $stmt->setQuery($query);
 $stmt->setKey("language");
 $aLanguage = $stmt->command();
 if (count($aLanguage) > 1) {
     sort($aLanguage);
     $res2 .= "<tr><td>";
     $res2 .= "Show only sources within this language</td><td><select id='filter_language' name='filter_language' style='editInputSelect' onChange='loadSources(\"" . $start . "\", 1);'>";
     $res2 .= "<option value=''>any</option>";
     for ($j = 0; $j <= count($aLanguage); $j++) {
         $l = trim($aLanguage[$j]);
         if (!empty($l)) {
             $res2 .= "<option value='" . $l . "'";
             if ($filter_language == $l) {
                 $res2 .= " selected";
             }
             $res2 .= ">" . str_replace("_", " ", $aLanguages[$l]) . "</option>";