Example #1
0
/**
 *
 * @param type $cat
 * @return type
 */
function global_news_category_caption($cat)
{
    $category = Config::App()->get('categories');
    $cat = $cat[0];
    foreach ($category as $key => $value) {
        $child = $value['child'];
        $label = '';
        $pref_url = '';
        if (in_array($cat, $child)) {
            $label = $value['label'];
            $pref_url = $key;
            break;
        }
    }
    return array('cat_url' => $pref_url . '/', 'cat_label' => $label);
    // $label;
}
Example #2
0
 function get_imageList($where = '', $limit = array())
 {
     if ($where) {
         $this->where($where);
     }
     if ($limit) {
         $this->limit($limit[0], $limit[1]);
     }
     $sql = $this->table($this->table)->orderby("photo_id", "DESC")->where("photo_path!=''")->create_query();
     $row = $this->query($sql)->fetchrow();
     foreach ($row as $no => $r) {
         $row[$no]['photo_date_formated'] = formatDate($r['photo_date'], 2, false);
         $row[$no]['photo_entry_formated'] = formatDate($r['photo_entry'], 2, false);
         // $row[$no]['photo_thumb_url'] = $this->config['klimg_url'] . $r['photo_path'] . '200xauto-' . $r['photo_url'];
         // $row[$no]['crop_url'] = $this->config['base_url'] . $this->ctrler . '/cropPopup/&id=' . $r['photo_id'] . '&t=' . date('s');
         $row[$no]['photo_thumb_url'] = Config::App()->get('klimg_url') . $r['photo_path'] . '200xauto-' . $r['photo_url'];
         $row[$no]['crop_url'] = Config::App()->get('base_url') . $this->ctrler . '/cropPopup/&id=' . $r['photo_id'] . '&t=' . date('s');
     }
     return $row;
 }
Example #3
0
function updateJsonDetail($file, $type = "news")
{
    $dir = Config::App()->get('json_detail_dir');
    $dir = $dir . $type . '/';
    $filename = $dir . $file;
    if (is_file($filename)) {
        unlink($filename);
        $dirLog = Config::App()->get('log_dir');
        create_directory($dirLog);
        $log = fopen($dirLog . 'log_update_json.txt', 'a+');
        fwrite($log, date("Y-m-d H:i:s") . "\t" . $file . "\n");
        fclose($log);
        return true;
    } else {
        return false;
    }
}