當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Projects::find方法代碼示例

本文整理匯總了PHP中Projects::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Projects::find方法的具體用法?PHP Projects::find怎麽用?PHP Projects::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Projects的用法示例。


在下文中一共展示了Projects::find方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: die

<?php

include 'config.php';
#include 'A/Db/Sqlite.php';
#include 'A/Db/Tabledatagateway.php';
class Projects extends A_Db_Tabledatagateway
{
}
$db = new A_Db_Sqlite3($ConfigArray['DBDSN_SQLITE']);
$db->connect();
if ($db->isError()) {
    die('ERROR: ' . $db->getMessage());
}
$project = new Projects($db);
$rows = $project->find(2);
dump($project->sql);
dump($rows);
$rows = $project->find('clients_id=', 1);
dump($project->sql);
dump($rows);
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:20,代碼來源:example_tabledatagateway_sqlite.php

示例2: findByUserAndCompany

 /**
  * Return projects visible for $user that have $company for client
  *
  * @param User $user
  * @param Company $company
  * @param boolean $all_for_admins_and_pms
  * @return array
  */
 function findByUserAndCompany($user, $company, $all_for_admins_and_pms = false)
 {
     if (!instance_of($user, 'User')) {
         return null;
     }
     // if
     if (instance_of($company, 'Company')) {
         $company_id = $company->getIsOwner() ? 0 : $company->getId();
     } else {
         return null;
     }
     // if
     // Admin or project manager
     if ($all_for_admins_and_pms && ($user->isProjectManager() || $user->isAdministrator())) {
         return Projects::find(array('conditions' => array('company_id = ?', $company_id), 'order' => 'name'));
     }
     // if
     // Clients and other members
     $rows = db_execute_all('SELECT project_id FROM ' . TABLE_PREFIX . 'project_users WHERE user_id = ?', $user->getId());
     if (is_foreachable($rows)) {
         $project_ids = array();
         foreach ($rows as $row) {
             $project_ids[] = (int) $row['project_id'];
         }
         // if
     } else {
         return null;
     }
     // if
     return Projects::find(array('conditions' => array('id IN (?) AND company_id = ?', $project_ids, $company_id), 'order' => 'name'));
 }
開發者ID:NaszvadiG,項目名稱:activecollab_loc,代碼行數:39,代碼來源:Projects.class.php

示例3: getOwnProjects

 /**
  * Return array of active projects that this user created
  *
  * @access public
  * @param void
  * @return array
  */
 function getOwnProjects()
 {
     if (is_null($this->own_projects)) {
         $this->own_projects = Projects::find('`created_by_id` = ' . $this->getId());
     }
     // if
     return $this->own_projects;
 }
開發者ID:pnagaraju25,項目名稱:fengoffice,代碼行數:15,代碼來源:User.class.php

示例4: die

<?php

ini_set('date.timezone', 'America/Los_Angeles');
include 'config.php';
// need to set the database type for PDO factory
$ConfigArray['DBDSN']['phptype'] = 'mysql';
//include 'A/Db/Pdo.php';
include 'A/Db/Tabledatagateway.php';
class Projects extends A_Db_Tabledatagateway
{
}
$db = new A_Db_Pdo($ConfigArray['DBDSN']);
$db->connect();
if ($db->isError()) {
    die('ERROR: ' . $db->getMessage());
}
$project = new Projects($db, 'users');
$rows = $project->find(1);
dump($project->sql);
dump($rows);
// Get the current row
dump($rows->current());
// Get all rows
$all = $rows->fetchAll();
dump($all);
// Update some data
$data = array('lastname' => 'testert');
$updated = $project->update($data, 'id = 1');
//dump($updated);
$rows = $project->find(1);
dump($rows->current());
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:31,代碼來源:tabledatagateway_pdo.php

示例5: getFullname

        parent::__construct($db);
    }
    public function getFullname()
    {
        return $this->data['title'] . ', ' . $this->data['name'] . ' ' . $this->data['surname'];
    }
}
$db = new A_Db_MySQL($config['db']);
$db->connect();
if ($db->isError()) {
    die('ERROR: ' . $db->getMessage());
}
Projects::setDb($db);
$project = new Projects();
#$project->find("id='3'");
$project->find("client_id='2'");
#$project->set('title', 'Mr');
#$project->set('name', 'Frodo');
#$project->set('surname', 'Baggins');
#$project->set('email', 'frodo@the-shire.com');
//User::getInstance();
echo 'table=' . $project->getTable() . '<br/>';
dump($project->toArray());
/*
$project->insert();
$project->unsetAttr();
$rs = $project->getAll();
foreach ( $rs as $result ) {
    echo $result->get('fullname') ."\n";
    // OR
    echo $result->fullname ."\n";
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:31,代碼來源:example.php

示例6: die

<?php

include 'config.php';
#include 'A/Db/Sqlite.php';
#include 'A/Db/Activerecord.php';
class Projects extends A_Db_Activerecord
{
}
$db = new A_Db_Sqlite3($ConfigArray['DBDSN_SQLITE']);
$db->connect();
if ($db->isError()) {
    die('ERROR: ' . $db->getMessage());
}
$project = new Projects($db);
$project->find(2);
dump($project->sql);
dump($project->toArray());
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:17,代碼來源:example_activerecord_sqlite.php


注:本文中的Projects::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。