本文整理汇总了PHP中AIR2_Record类的典型用法代码示例。如果您正苦于以下问题:PHP AIR2_Record类的具体用法?PHP AIR2_Record怎么用?PHP AIR2_Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AIR2_Record类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: air_create
/**
* Create
*
* @param array $data
* @return unknown
*/
protected function air_create($data)
{
if (!isset($data['prj_uuid'])) {
throw new Rframe_Exception(Rframe::BAD_DATA, "prj_uuid required");
}
$prj = AIR2_Record::find('Project', $data['prj_uuid']);
if (!$prj) {
$u = $data['prj_uuid'];
throw new Rframe_Exception(Rframe::BAD_DATA, "Invalid prj_uuid '{$u}'");
}
$pinq = new ProjectInquiry();
$pinq->pinq_inq_id = $this->parent_rec->inq_id;
$pinq->Project = $prj;
$pinq->mapValue('prj_uuid', $pinq->Project->prj_uuid);
// adding a Project to a Query requires write authz on the Query, not the Project.
if (!$pinq->user_may_write($this->user)) {
throw new Rframe_Exception(Rframe::BAD_DATA, "Invalid Query authz");
}
// log activity
$activity = new InquiryActivity();
$activity->ia_inq_id = $this->parent_rec->inq_id;
$activity->ia_actm_id = 49;
$activity->ia_dtim = air2_date();
$activity->ia_desc = sprintf('project %s added by {USER}', $prj->prj_name);
$this->parent_rec->InquiryActivity[] = $activity;
return $pinq;
}
示例2: air_create
/**
* Create
*
* @param array $data
* @return unknown
*/
protected function air_create($data)
{
if (!isset($data['org_uuid'])) {
throw new Rframe_Exception(Rframe::BAD_DATA, "org_uuid required");
}
$org = AIR2_Record::find('Organization', $data['org_uuid']);
if (!$org) {
$u = $data['org_uuid'];
throw new Rframe_Exception(Rframe::BAD_DATA, "Invalid org_uuid '{$u}'");
}
if (!$this->parent_rec->user_may_write($this->user)) {
throw new Rframe_Exception(Rframe::BAD_DATA, "You do not appear to have access to modify this Inquiry (Invalid Inquiry authz)");
}
$iorg = new InqOrg();
$iorg->iorg_inq_id = $this->parent_rec->inq_id;
$iorg->Organization = $org;
$iorg->mapValue('org_uuid', $iorg->Organization->org_uuid);
// log activity
$activity = new InquiryActivity();
$activity->ia_inq_id = $this->parent_rec->inq_id;
$activity->ia_actm_id = 49;
$activity->ia_dtim = air2_date();
$activity->ia_desc = sprintf('org %s added by {USER}', $org->org_name);
$this->parent_rec->InquiryActivity[] = $activity;
return $iorg;
}
示例3: air_create
/**
* Create
*
* @param array $data
* @return Doctrine_Record $rec
*/
protected function air_create($data)
{
$p = new Project();
// org_uuid required
if (!isset($data['org_uuid'])) {
throw new Rframe_Exception(Rframe::BAD_DATA, 'Project Organization uuid required!');
}
$org = AIR2_Record::find('Organization', $data['org_uuid']);
if (!$org) {
throw new Rframe_Exception(Rframe::BAD_DATA, 'Invalid Organization specified!');
}
$p->ProjectOrg[0]->porg_contact_user_id = $this->user->user_id;
$p->ProjectOrg[0]->Organization = $org;
// immediately add inquiry to project
if (isset($data['inq_uuid'])) {
$inq = AIR2_Record::find('Inquiry', $data['inq_uuid']);
if (!$inq) {
throw new Rframe_Exception(Rframe::BAD_DATA, 'Invalid Inquiry specified!');
}
if (!$inq->user_may_write($this->user)) {
throw new Rframe_Exception(Rframe::BAD_AUTHZ, 'Invalid Inquiry authz!');
}
$p->ProjectInquiry[0]->Inquiry = $inq;
}
return $p;
}
示例4: show_print_html
/**
* Load data for html printing
*
* @param type $uuid
* @param type $base_rs
*/
protected function show_print_html($uuid, $base_rs)
{
$bin = AIR2_Record::find('Bin', $uuid);
$base_rs['sources'] = array();
// authorized sources
$authz_sources = array();
$q = Doctrine_Query::create()->from('BinSource bs');
$q->leftJoin('bs.Source s');
$q->where('bs.bsrc_bin_id = ?', $bin->bin_id);
$q->select('bs.bsrc_src_id, s.src_uuid');
BinSource::query_may_read($q, $this->user, 'bs');
$bsrcs = $q->fetchArray();
foreach ($bsrcs as $bsrc) {
$authz_sources[$bsrc['Source']['src_uuid']] = true;
}
// only keep fetching if there is stuff to get
$authz_responses = array();
if (count($authz_sources) > 0) {
$q = Doctrine_Query::create()->from('BinSrcResponseSet bs');
$q->leftJoin('bs.SrcResponseSet s');
$q->where('bs.bsrs_bin_id = ?', $bin->bin_id);
$q->select('bs.bsrs_srs_id, s.srs_uuid');
BinSrcResponseSet::query_may_read($q, $this->user, 'bs');
$bsrss = $q->fetchArray();
foreach ($bsrss as $bsrs) {
$authz_responses[$bsrs['SrcResponseSet']['srs_uuid']] = true;
}
// let perl do the heavy lifting
$binsources = CallPerl::exec('AIR2::Bin->flatten', $bin->bin_id);
foreach ($binsources as $src) {
$src_uuid = $src['src_uuid'];
if (isset($authz_sources[$src_uuid])) {
// apply authz to responses
if (is_array($src['response_sets'])) {
foreach ($src['response_sets'] as $idx => $srs) {
$srs_uuid = $srs['srs_uuid'];
if (!isset($authz_responses[$srs_uuid])) {
unset($src['response_sets'][$idx]);
}
}
$src['response_sets'] = array_values($src['response_sets']);
}
// add as value
$authz_sources[$src_uuid] = $src;
}
}
}
// reorganize for the print view
$raw = array('bin' => $base_rs['radix'], 'sources' => array_values($authz_sources));
$this->airoutput->view = 'print/bin';
$this->response($raw);
}
示例5: air_create
/**
* RESTful Create
*
* @param array $data
* @return BinSource $rec
*/
protected function air_create($data)
{
$this->require_data($data, array('src_uuid'));
$src = AIR2_Record::find('Source', $data['src_uuid']);
if (!$src) {
throw new Rframe_Exception(Rframe::BAD_DATA, 'Invalid Source specified!');
}
$b = new BinSource();
$b->Bin = $this->parent_rec;
$b->Source = $src;
$b->mapValue('src_uuid', $src->src_uuid);
return $b;
}
示例6: air_create
/**
* Create
*
* @param array $data
* @return Doctrine_Record $rec
*/
protected function air_create($data)
{
$o = new Organization();
// org parent (optional)
if (isset($data['org_parent_uuid'])) {
$parent = AIR2_Record::find('Organization', $data['org_parent_uuid']);
if (!$parent) {
throw new Rframe_Exception(Rframe::BAD_DATA, 'Invalid parent Org specified!');
}
$o->parent = $parent;
}
return $o;
}
示例7: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('Tank', array('local' => 'tact_tank_id', 'foreign' => 'tank_id', 'onDelete' => 'CASCADE'));
$this->hasOne('ActivityMaster', array('local' => 'tact_actm_id', 'foreign' => 'actm_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Project', array('local' => 'tact_prj_id', 'foreign' => 'prj_id', 'onDelete' => 'CASCADE'));
}
示例8: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('User', array('local' => 'bin_user_id', 'foreign' => 'user_id', 'onDelete' => 'CASCADE'));
$this->hasMany('BinSource', array('local' => 'bin_id', 'foreign' => 'bsrc_bin_id'));
$this->hasMany('BinSrcResponseSet', array('local' => 'bin_id', 'foreign' => 'bsrs_bin_id'));
}
示例9: setUp
/**
* Setup relationships
*/
public function setUp()
{
parent::setUp();
$this->hasMany('TestRelatedRecord', array('local' => 'test_id', 'foreign' => 'tr_test_id'));
// Tagging
$this->hasMany('TagTestRecord as Tags', array('local' => 'test_id', 'foreign' => 'tag_xid'));
}
示例10: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('TankSource', array('local' => 'trs_tsrc_id', 'foreign' => 'tsrc_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Inquiry', array('local' => 'srs_inq_id', 'foreign' => 'inq_id'));
$this->hasMany('TankResponse', array('local' => 'trs_id', 'foreign' => 'tr_trs_id'));
}
示例11: save
/**
* Override save() to workaround Doctrine bug in cascading save().
*
* @return parent::save()
*/
public function save()
{
if (!$this->iorg_org_id) {
throw new Exception("iorg_org_id not set");
}
return parent::save();
}
示例12: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('TankResponseSet', array('local' => 'tr_trs_id', 'foreign' => 'trs_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Question', array('local' => 'sr_ques_id', 'foreign' => 'ques_id'));
$this->hasOne('TankSource', array('local' => 'tr_tsrc_id', 'foreign' => 'tsrc_id', 'onDelete' => 'CASCADE'));
}
示例13: setTableDefinition
/**
* Set the table columns
*/
public function setTableDefinition()
{
$this->setTableName('state');
$this->hasColumn('state_id', 'integer', 4, array('primary' => true, 'autoincrement' => true));
$this->hasColumn('state_name', 'string', 128, array('notnull' => true));
$this->hasColumn('state_code', 'string', 2, array('fixed' => true, 'notnull' => true));
parent::setTableDefinition();
}
示例14: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('SrcResponseSet', array('local' => 'sr_srs_id', 'foreign' => 'srs_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Question', array('local' => 'sr_ques_id', 'foreign' => 'ques_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Source', array('local' => 'sr_src_id', 'foreign' => 'src_id', 'onDelete' => 'CASCADE'));
$this->hasMany('SrAnnotation', array('local' => 'sr_id', 'foreign' => 'sran_sr_id'));
}
示例15: setTableDefinition
/**
* Set the table columns
*/
public function setTableDefinition()
{
$this->setTableName('stale_record');
$this->hasColumn('str_xid', 'integer', 4, array('primary' => true));
$this->hasColumn('str_type', 'string', 1, array('primary' => true));
$this->hasColumn('str_upd_dtim', 'timestamp', null, array('notnull' => true));
parent::setTableDefinition();
}