本文整理汇总了PHP中ActiveRecord::find方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::find方法的具体用法?PHP ActiveRecord::find怎么用?PHP ActiveRecord::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_should_destroy_the_thumbnail_even_when_not_loaded
public function test_should_destroy_the_thumbnail_even_when_not_loaded()
{
$Picture =& $this->Picture->find('first');
$Picture->destroy();
$this->assertFalse($this->Thumbnail->find('first'),'Issue #125');
}
示例2: test_destroying_should_cascade
public function test_destroying_should_cascade()
{
$Property = new Property(array('description' => 'This is a Property'));
$Picture = $Property->picture->create(array('title' => 'Front'));
$Property->destroy();
$this->assertFalse($this->Property->find('first', array('default' => false)));
$this->assertFalse($this->Picture->find('first', array('default' => false)));
}
示例3: Hybrid
function test_null_should_not_be_casted_as_false_on_booleans()
{
$Celebrity =& new Hybrid(array('title' => 'Franko', 'celebrity' => null));
$Celebrity->save();
$Celebrity =& $this->Hybrid->find('first', array('title' => 'Franko'));
$this->assertNull($Celebrity->celebrity);
}
示例4: verPerfil
public function verPerfil()
{
$db = new db();
$db->connect();
$C = new ActiveRecord('fk_perfiles');
$C->find($this->id_perfil);
$db->close();
return $C->fields;
}
示例5: verUsuario
public function verUsuario()
{
$db = new db();
$db->connect();
$C = new ActiveRecord('usuarios');
$C->find($this->id_usuario);
$db->close();
return $C->fields;
}
示例6: verEstado
public static function verEstado()
{
$db = new db();
$db->connect();
$C = new ActiveRecord('lista_estados');
$C->find(self::$id_estado);
$db->close();
return $C->fields;
}
示例7: findModelLang
/**
* Search by model pervychnomu key
* If the pattern is not found, returns null
* @param integer $id Ідентифікатор моделі
* @return {Model}Lang Повернення знайденої моделі
*/
protected function findModelLang($id)
{
if ($id) {
$model = $this->modelLang->find()->andWhere(['rid' => $id])->one();
}
if ($model === null) {
$model = $this->modelLang->loadDefaultValues();
}
return $model;
}
示例8: deleteItems
function deleteItems()
{
$nr_ids = $_POST['nr_ids'];
for ($i = 0; $i < $nr_ids; $i++) {
$id = $_POST['delete_id_' . $i];
$record = $this->ar->find($id);
$record->delete();
}
if ($i == 1) {
ilUtil::sendSuccess($this->getDeleteRecordMessage(), true);
} else {
ilUtil::sendSuccess($this->getDeleteRecordsMessage(), true);
}
$this->ctrl->redirect($this, "index");
}
示例9: getPages
public function getPages($category)
{
$blog = new ActiveRecord();
$blog->connectPdo('blogdb', 'categorytable', 'readonly', 'readonly');
$data = $blog->findFromKey('category', $category);
$ids = array();
foreach ($data as $row) {
$ids[] = $row->postid;
}
$blog->connectPdo('blogdb', 'blog', 'readonly', 'readonly');
$result = array();
foreach ($ids as $pagenum) {
$result[] = $blog->find($pagenum);
}
return $result;
}
示例10: print_form_field
/**
*@package db_record
*@method print_form_field()
*@desc returns the list of html fields automatically from a record
*@since v0.1 beta
* */
public function print_form_field($field, $CssName = '', $ExtraAttributes = '', $encode_fields = FALSE, $access = TRUE, $read_only = FALSE, $code = '')
{
$html_fld = '';
if ($encode_fields == TRUE) {
$field_id_html = 'fkf_' . encode($field . $code);
$field_name_html = encode($field . $code);
} else {
$field_id_html = $field . $code;
$field_name_html = $field . $code;
}
$original_type = $this->form_fields[$field]['Type'];
$type_x = explode("(", $original_type);
if ($type_x > 1) {
$type = $type_x[0];
} else {
$type = $original_type;
}
// Display Mode
$mode_view_edit = $this->field_mode == 'view-edit' ? true : false;
if ($read_only == true) {
// read only
$display_as = 'read-only';
} else {
if ($this->field_mode == 'view-edit') {
$display_as = 'view-edit';
} else {
$display_as = 'edit';
}
}
if ($this->useHtmlEntities_onField == true) {
$this->fields[$field] = isset($this->fields[$field]) ? htmlentities($this->fields[$field]) : '';
} else {
$this->fields[$field] = isset($this->fields[$field]) ? $this->fields[$field] : '';
}
switch ($type) {
case "varchar":
// Class
$Class = 'class="txt ' . @$CssName . '"';
if ($access == TRUE) {
if ($display_as == 'view-edit') {
$html_fld .= '<div class="fld" onclick="appForm_updfldTxt({id:\'' . $field_id_html . '\'})"><input style="display:none" id="' . $field_id_html . '" name="' . $field_name_html . '" type="text" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
$html_fld .= '<span id="val-' . $field_id_html . '">' . @$this->fields[$field] . '</span> <span class="ui-icon ui-icon-gear"></span></div>';
$html_fld .= '<input id="cur-v-' . $field_id_html . '" type="hidden" value="' . $this->fields[$field] . '" />';
} elseif ($display_as == 'edit') {
$html_fld .= '<input id="' . $field_id_html . '" name="' . $field_name_html . '" type="text" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
} elseif ($display_as == 'read-only') {
$html_fld .= @$this->fields[$field] . '<input id="' . $field_id_html . '" name="' . $field_name_html . '" type="hidden" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
}
}
break;
case "money":
// Class
$Class = 'class="txt ' . @$CssName . '"';
if ($access == TRUE) {
if ($display_as == 'view-edit') {
$html_fld .= '<div class="fld" onclick="appForm_updfldTxt({id:\'' . $field_id_html . '\'})">$<input style="display:none" id="' . $field_id_html . '" name="' . $field_name_html . '" type="text" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
$html_fld .= '<span id="val-' . $field_id_html . '">' . @$this->fields[$field] . '</span> <span class="ui-icon ui-icon-gear"></span></div>';
$html_fld .= '<input id="cur-v-' . $field_id_html . '" type="hidden" value="' . $this->fields[$field] . '" />';
} elseif ($display_as == 'edit') {
$html_fld .= '';
$html_fld .= '<div class="input-prepend"><span class="add-on">$</span><input id="' . $field_id_html . '" name="' . $field_name_html . '" type="text" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' /></div>';
} elseif ($display_as == 'read-only') {
$html_fld .= fk_money_format($this->fields[$field]) . '<input id="' . $field_id_html . '" name="' . $field_name_html . '" type="hidden" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
}
}
break;
case "file":
// Class
$Class = 'class="txt ' . @$CssName . '"';
if ($access == TRUE) {
if ($display_as == 'view-edit') {
$html_fld .= '<div class="fld" onclick="appForm_updfldTxt({id:\'' . $field_id_html . '\'})"><input style="display:none" id="' . $field_id_html . '" name="' . $field_name_html . '" type="text" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
$html_fld .= '<span id="val-' . $field_id_html . '">' . @$this->fields[$field] . '</span> <span class="ui-icon ui-icon-gear"></span></div>';
$html_fld .= '<input id="cur-v-' . $field_id_html . '" type="hidden" value="' . $this->fields[$field] . '" />';
} elseif ($display_as == 'edit') {
$html_fld .= '<input id="' . $field_id_html . '" name="' . $field_name_html . '" type="hidden" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
$html_fld .= '<br><iframe src="' . fk_link() . 'FkMaster/upolader/' . $field_id_html . '/" name="ifrmupl-' . $field_id_html . '" style="width:95%;height:45px;" frameborder="0"></iframe>';
$file_data = '';
$ArUpl = new ActiveRecord('uploads');
$totUpl = $ArUpl->find(@$this->fields[$field]);
if ($totUpl == 1) {
if (strrpos($ArUpl->fields['tipo'], 'image') > -1) {
//image
$file_data = '<a href="' . http_uploads() . $ArUpl->fields['archivo'] . '" target="_blank"><img src="' . http_uploads() . $ArUpl->fields['archivo'] . '" ></a>';
} else {
//Other file
$file_data = '<a href="' . http_uploads() . $ArUpl->fields['archivo'] . '" target="_blank">' . $ArUpl->fields['titulo'] . '</a>';
}
}
$html_fld .= '<div id="ico-' . $field_id_html . '">' . $file_data . '</div>';
} elseif ($display_as == 'read-only') {
$html_fld .= '<input id="' . $field_id_html . '" name="' . $field_name_html . '" type="hidden" value="' . @$this->fields[$field] . '" ' . $Class . ' ' . @$ExtraAttributes . ' />';
$file_data = '';
$ArUpl = new ActiveRecord('uploads');
//.........这里部分代码省略.........
示例11: test_add_group_by_clause
public function test_add_group_by_clause()
{
$this->Db->expectAt(0,'select',array('SELECT * FROM hybrids GROUP BY id','selecting'));
$this->Hybrid->find('all',array('group'=>'id'));
}
示例12: find
static function find($id, $options = null)
{
return parent::find(__CLASS__, $id, $options);
}
示例13: fk_file_field
/**
* @desc File field Object
* */
function fk_file_field($id, $name, $value, $onclick = null, $cssExtra = '', $mode = 'edit')
{
$html_fld = '';
if ($mode == 'edit') {
$html_fld .= '<input id="' . $id . '" name="' . $name . '" type="hidden" value="' . $value . '" class="' . $cssExtra . '" />';
$html_fld .= '<br><iframe src="' . fk_link() . 'FkMaster/upolader/' . $id . '/" name="ifrmupl-' . $id . '" style="width:95%;height:30px;" frameborder="0"></iframe>';
}
$file_data = '';
$ArUpl = new ActiveRecord('uploads');
$totUpl = $ArUpl->find($value);
if ($totUpl == 1) {
if (strrpos($ArUpl->fields['tipo'], 'image') > -1) {
//image
$file_data = '<a href="' . http_uploads() . $ArUpl->fields['archivo'] . '" target="_blank"><img src="' . http_uploads() . $ArUpl->fields['archivo'] . '" ></a>';
} else {
//Other file
$file_data = '<a href="' . http_uploads() . $ArUpl->fields['archivo'] . '" target="_blank">' . $ArUpl->fields['titulo'] . '</a>';
}
}
$html_fld .= '<div id="ico-' . $id . '">' . $file_data . '</div>';
return $html_fld;
}
示例14: deleteLine
private function deleteLine()
{
$tableId = fk_post('tId');
$id = fk_post($tableId . '_recId-' . fk_post('recIdToDel'));
if ($id > 0) {
$Ar = new ActiveRecord($this->table_name);
$Ar->find($id);
$Ar->delete();
}
}
示例15: fk_message
<form id="frm3" id="frm3" onsubmit="return false;">
<h1>Paso 2 de 3</h1>
<div>
<?php
echo fk_message('warning', '<b>Elija información:</b> Seleccione las columnas y los renglones que desea importar', false);
$Imp = new FileImporter();
$File = new ActiveRecord('uploads');
$File->find(fk_post('archivo'));
$f = uploads_directory() . '/' . $File->fields['archivo'];
$tablefields = $GLOBALS['tableFields'];
?>
<div style="width:100%; height:500px; overflow:auto;">
<?php
// Imprime tabla de resultado
$Imp->importExcelData($f, $tablefields);
?>
</div>
<input type="button" class="btn" onclick="$('#cont').show(800); $('#cont2').hide(800);" value=" « Regresar ">
<input type="submit" class="btn" value="Importar »">
</div>
<div class="clear"></div>
</form>
<script type="text/javascript">
<!--
$("#frm3").validate({
submitHandler: function(form) {
var pArgs = {pDiv:'cont3',
pUrl:'<?php