コード例 #1
0
ファイル: DAO.php プロジェクト: semul/Osclass
 /**
  * Returns the number of rows in the table represented by this object.
  * 
  * @access public
  * @since unknown
  * @return int
  */
 public function count()
 {
     $this->dao->select('COUNT(*) AS count');
     $this->dao->from($this->getTableName());
     $result = $this->dao->get();
     if ($result == false) {
         return 0;
     }
     if ($result->numRows() == 0) {
         return 0;
     }
     $row = $result->row();
     return $row['count'];
 }
コード例 #2
0
ファイル: functions.php プロジェクト: syedfiraat4/bikade.com
function seo_get_row($itemID)
{
    $conn = DBConnectionClass::newInstance();
    $c_db = $conn->getOsclassDb();
    $comm = new DBCommandClass($c_db);
    $comm->select();
    $comm->from(SEO_PLUGIN_ITEM_META_TABLE);
    $comm->where('fk_i_item_id', $itemID);
    $rs = $comm->get();
    if ($rs === false) {
        return false;
    }
    if ($rs->numRows() != 1) {
        return false;
    }
    return $detail = $rs->row();
}
コード例 #3
0
ファイル: functions.php プロジェクト: oanav/closetshare
function osc_search_footer_links()
{
    if (!osc_rewrite_enabled()) {
        return array();
    }
    $categoryID = osc_search_category_id();
    if (!empty($categoryID)) {
        if (Category::newInstance()->isRoot(current($categoryID))) {
            $cat = Category::newInstance()->findSubcategories(current($categoryID));
            if (count($cat) > 0) {
                $categoryID = array();
                foreach ($cat as $c) {
                    $categoryID[] = $c['pk_i_id'];
                }
            }
        }
    }
    if (osc_search_city() != '') {
        return array();
    }
    $regionID = '';
    if (osc_search_region() != '') {
        $aRegion = Region::newInstance()->findByName(osc_search_region());
        if (isset($aRegion['pk_i_id'])) {
            $regionID = $aRegion['pk_i_id'];
        }
    }
    $conn = DBConnectionClass::newInstance();
    $data = $conn->getOsclassDb();
    $comm = new DBCommandClass($data);
    $comm->select('i.fk_i_category_id');
    $comm->select('l.*');
    $comm->select('COUNT(*) AS total');
    $comm->from(DB_TABLE_PREFIX . 't_item as i');
    $comm->from(DB_TABLE_PREFIX . 't_item_location as l');
    if (!empty($categoryID)) {
        $comm->whereIn('i.fk_i_category_id', $categoryID);
    }
    $comm->where('i.pk_i_id = l.fk_i_item_id');
    $comm->where('i.b_enabled = 1');
    $comm->where('i.b_active = 1');
    $comm->where(sprintf("dt_expiration >= '%s'", date('Y-m-d H:i:s')));
    $comm->where('l.fk_i_region_id IS NOT NULL');
    $comm->where('l.fk_i_city_id IS NOT NULL');
    if ($regionID != '') {
        $comm->where('l.fk_i_region_id', $regionID);
        $comm->groupBy('l.fk_i_city_id');
    } else {
        $comm->groupBy('l.fk_i_region_id');
    }
    $rs = $comm->get();
    if (!$rs) {
        return array();
    }
    return $rs->result();
}