本文整理汇总了PHP中AIR2_Record类的典型用法代码示例。如果您正苦于以下问题:PHP AIR2_Record类的具体用法?PHP AIR2_Record怎么用?PHP AIR2_Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AIR2_Record类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:33,代码来源:project.php
示例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;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:32,代码来源:organization.php
示例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;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:32,代码来源:project.php
示例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);
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:58,代码来源:bin_controller.php
示例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;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:19,代码来源:source.php
示例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;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:19,代码来源:organization.php
示例7: show_html
/**
* Load inline HTML
*
* @param type $uuid
* @param type $base_rs
*/
protected function show_html($uuid, $base_rs)
{
$inq = AIR2_Record::find('Inquiry', $uuid);
// redmine #7794 adminstrative queries disallowed for non-system users
if (!$this->user->is_system()) {
if ($inq && $inq->inq_type == Inquiry::$TYPE_MANUAL_ENTRY) {
$this->airoutput->write_error(403, 'Query for internal use only', 'This query is for internal use only');
return;
}
}
$search_query = array('q' => "inq_uuid={$uuid}");
$inline = array('UUID' => $base_rs['uuid'], 'URL' => air2_uri_for($base_rs['path']), 'BASE' => $base_rs, 'QUESDATA' => $this->api->query("inquiry/{$uuid}/question", array('limit' => 0, 'sort' => 'ques_dis_seq asc')), 'QUESTPLS' => AIR2_QueryBuilder::get_defs(), 'QUESURL' => air2_uri_for("inquiry/{$uuid}/question"), 'ORGDATA' => $this->api->query("inquiry/{$uuid}/organization", array('sort' => 'org_display_name asc')), 'PROJDATA' => $this->api->query("inquiry/{$uuid}/project", array('sort' => 'prj_display_name asc')), 'OUTDATA' => $this->api->query("inquiry/{$uuid}/outcome", array('limit' => 10)), 'ANNOTDATA' => $this->api->query("inquiry/{$uuid}/annotation", array('limit' => 3, 'sort' => 'inqan_cre_dtim desc')), 'TAGDATA' => $this->api->query("inquiry/{$uuid}/tag", array('limit' => 0)), 'STATSDATA' => $this->_stats_data($inq), 'SUBMDATA' => $this->api->query("inquiry/{$uuid}/submission", array('limit' => 5)), 'SUBMSRCH' => air2_uri_for("reader/query/{$uuid}"), 'ACTIVDATA' => $this->api->query("inquiry/{$uuid}/activity", array('limit' => 5)), 'AUTHORDATA' => $this->api->query("inquiry/{$uuid}/author", array('limit' => 5)), 'WATCHERDATA' => $this->api->query("inquiry/{$uuid}/watcher", array('limit' => 5)));
// show page
$title = $base_rs['radix']['inq_ext_title'] . ' - ' . AIR2_SYSTEM_DISP_NAME;
$data = $this->airhtml->get_inline($title, 'Inquiry', $inline);
$this->response($data);
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:23,代码来源:query_controller.php
示例8: show_html
/**
* Load inline HTML
*
* @param type $uuid
* @param type $base_rs
*/
protected function show_html($uuid, $base_rs)
{
// Record visit by the current user against the current source. See UserVisit model.
$source = AIR2_Record::find('Source', $uuid);
$source->visit(array('ip' => $this->input->ip_address(), 'user' => $this->user));
/**
* Prep and display page.
*/
$search_query = array('q' => "src_uuid={$uuid}");
$inline = array('UUID' => $base_rs['uuid'], 'URL' => air2_uri_for($base_rs['path']), 'BASE' => $base_rs, 'SUBMSRCH' => air2_uri_for('search/responses', $search_query), 'ORGDATA' => $this->api->query("source/{$uuid}/organization", array('limit' => 5, 'sort' => 'so_home_flag desc,so_status asc,org_display_name asc')), 'SUBMDATA' => $this->api->query("source/{$uuid}/submission", array('limit' => 8, 'sort' => 'srs_date desc,srs_cre_dtim desc')), 'FACTDATA' => $this->api->query("source/{$uuid}/fact", array('limit' => 7, 'sort' => 'fact_id asc')), 'ACTVDATA' => $this->api->query("source/{$uuid}/activity", array('limit' => 5, 'sort' => 'sact_dtim desc')), 'INTDATA' => $this->api->query("source/{$uuid}/interest", array('limit' => 5)), 'EXPDATA' => $this->api->query("source/{$uuid}/experience", array('limit' => 5)), 'ANNOTDATA' => $this->api->query("source/{$uuid}/annotation", array('limit' => 4, 'sort' => 'srcan_upd_dtim desc')), 'TAGDATA' => $this->api->query("source/{$uuid}/tag", array('limit' => 0)), 'OUTDATA' => $this->api->query("source/{$uuid}/outcome", array('limit' => 4)), 'PREFDATA' => $this->api->query("source/{$uuid}/preference", array('limit' => 4)), 'STATSDATA' => $this->_stats_data($uuid), 'FLDDATA' => $this->api->query("fact", array('limit' => 0)), 'PREFSDATA' => $this->api->query("preference", array('pt_identifier' => 'preferred_language', 'limit' => 0)));
// show page
$uname = $base_rs['radix']['src_username'];
$first = $base_rs['radix']['src_first_name'];
$last = $base_rs['radix']['src_last_name'];
$name = $first && $last ? "{$first} {$last}" : $uname;
$title = "{$name} - " . AIR2_SYSTEM_DISP_NAME;
$data = $this->airhtml->get_inline($title, 'Source', $inline);
$this->response($data);
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:25,代码来源:source_controller.php
示例9: get_manual_entry_inquiry
/**
* Gets (or creates, if DNE) the manual-input inquiry associated with this
* particular project. This is used to manually enter source responses for
* things like emails and phone calls.
*
* @return Inquiry
*/
public function get_manual_entry_inquiry()
{
$me_uuid = air2_str_to_uuid('me-' . $this->prj_name);
$inq = AIR2_Record::find('Inquiry', $me_uuid);
if (!$inq) {
$inq = Inquiry::make_manual_entry();
$inq->inq_uuid = $me_uuid;
$inq->add_projects(array($this));
$orgs = array();
foreach ($this->ProjectOrg as $porg) {
$orgs[] = $porg->Organization;
}
$inq->add_orgs($orgs);
$inq->save();
}
return $inq;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:24,代码来源:Project.php
示例10: 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'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:TankActivity.php
示例11: 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'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:Bin.php
示例12: 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'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:TestRecord.php
示例13: 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'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:TankResponseSet.php
示例14: 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();
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:12,代码来源:InqOrg.php
示例15: 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'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:TankResponse.php
示例16: 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();
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:State.php
示例17: 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'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:SrcResponse.php
示例18: 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();
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:StaleRecord.php
示例19: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('Bin', array('local' => 'bsrs_bin_id', 'foreign' => 'bin_id', 'onDelete' => 'CASCADE'));
$this->hasOne('SrcResponseSet', array('local' => 'bsrs_srs_id', 'foreign' => 'srs_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Inquiry', array('local' => 'bsrs_inq_id', 'foreign' => 'inq_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Source', array('local' => 'bsrs_src_id', 'foreign' => 'src_id', 'onDelete' => 'CASCADE'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:BinSrcResponseSet.php
示例20: setUp
/**
* Set table relations
*/
public function setUp()
{
parent::setUp();
$this->hasOne('TankSource', array('local' => 'tf_tsrc_id', 'foreign' => 'tsrc_id', 'onDelete' => 'CASCADE'));
$this->hasOne('Fact', array('local' => 'tf_fact_id', 'foreign' => 'fact_id'));
$this->hasOne('FactValue as AnalystFV', array('local' => 'sf_fv_id', 'foreign' => 'fv_id'));
$this->hasOne('FactValue as SourceFV', array('local' => 'sf_src_fv_id', 'foreign' => 'fv_id'));
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:TankFact.php
注:本文中的AIR2_Record类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论