当前位置: 首页>>代码示例>>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;未经允许,请勿转载。