本文整理汇总了PHP中Zend_Db_Table类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table类的具体用法?PHP Zend_Db_Table怎么用?PHP Zend_Db_Table使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Db_Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aclconfigAction
public function aclconfigAction()
{
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout()->disableLayout();
$methods = get_class_methods('StudentController');
$actions = array();
foreach ($methods as $value) {
$actions[] = substr("{$value}", 0, strpos($value, 'Action'));
}
foreach ($actions as $key => $value) {
if ($value == null) {
unset($actions[$key]);
}
}
$db = new Zend_Db_Table();
$delete2 = 'DELETE FROM `tnp`.`mod_role_resource` WHERE `module_id`=? AND `controller_id`=?';
$db->getAdapter()->query($delete2, array('tnp', 'student'));
$delete1 = 'DELETE FROM `tnp`.`mod_action` WHERE `module_id`=? AND `controller_id`=?';
$db->getAdapter()->query($delete1, array('tnp', 'student'));
print_r(sizeof($actions));
$sql = 'INSERT INTO `tnp`.`mod_action`(`module_id`,`controller_id`,`action_id`) VALUES (?,?,?)';
foreach ($actions as $action) {
$bind = array('tnp', 'student', $action);
$db->getAdapter()->query($sql, $bind);
}
$sql = 'INSERT INTO `tnp`.`mod_role_resource`(`role_id`,`module_id`,`controller_id`,`action_id`) VALUES (?,?,?,?)';
foreach ($actions as $action) {
$bind = array('student', 'tnp', 'student', $action);
$db->getAdapter()->query($sql, $bind);
}
}
示例2: __construct
/**
* Class constructor
*
* @param Zend_Db_Adapter $db Database adapter instance
* @param Zend_Db_Table $table
* @param array $columnMap
* @return void
*/
public function __construct($db, Zend_Db_Table $table, $columnMap = null)
{
$info = $table->info();
parent::__construct($db, $info['schema'] . '.' . $info['name'], $columnMap);
$this->_db = $db;
$this->_table = $table;
$this->_columnMap = $columnMap;
}
示例3: updateCommentsAd
public function updateCommentsAd($id, $count)
{
$id = (int) $id;
$table = new Zend_Db_Table('commentsAdCount');
$sql = "INSERT INTO commentsAdCount ( id_comment, count ) VALUES ( ?,? )\n ON DUPLICATE KEY UPDATE id_comment = ?, count = ?";
$values = array("id_comment" => $id, "count" => $count);
$result = $table->getAdapter()->query($sql, array_merge(array_values($values), array_values($values)));
}
示例4: setup
/**
* (non-PHPdoc)
* @see models/Sahara/Auth/Sahara_Auth_Session::setup()
*/
public function setup()
{
$table = new Zend_Db_Table('users');
$record = $table->fetchRow($table->select()->where('name = ?', $this->_authType->getUsername())->where('namespace = ?', $this->_config->institution));
/* User name exists, so no need to create account. */
if ($record) {
return;
}
$table->insert(array('name' => $this->_authType->getUsername(), 'namespace' => $this->_config->institution, 'persona' => 'USER'));
}
示例5: formAction
public function formAction()
{
$table = new Zend_Db_Table();
$table->setOptions(array('name' => 'test'));
$table->setMetadataCacheInClass(true);
$data = array('listorder' => '11');
$table->insert($data);
Zend_Debug::dump($table);
die;
}
示例6: getLastAccess
public static function getLastAccess($classroomId, $data)
{
$access = new Zend_Db_Table('content_access');
$select = $access->select()->where('classroom_id = ?', $classroomId)->order('content_access.id DESC');
$row = $access->fetchRow($select);
if ($row) {
return self::getPositionById($row->content_id, $data);
}
return 0;
}
示例7: getRol
/**
* Retorna el Rol del usuario actual
*
* @return string
*/
private function getRol()
{
$rolStr = 'guest';
if ($this->_auth->hasIdentity()) {
$numRol = $this->_auth->getIdentity()->rol;
$tablaRol = new Zend_Db_Table('roles');
$rol = $tablaRol->fetchRow($tablaRol->select()->from($tablaRol)->where('idRol = ?', $numRol));
$rolStr = $rol['rol'];
}
return $rolStr;
}
示例8: info
/**
* Show table info (DESCRIBE query) for given table
*
* @param array $args
* @return void
*/
public function info(array $args = array())
{
if (empty($args)) {
Garp_Cli::errorOut('Insufficient arguments');
Garp_Cli::lineOut('Usage: garp Db info <tablename>');
return;
}
$db = new Zend_Db_Table($args[0]);
Garp_Cli::lineOut(Zend_Config_Writer_Yaml::encode($db->info()));
Garp_Cli::lineOut('');
}
示例9: indexAction
public function indexAction()
{
$queries = (int) $this->getParam('queries', 1);
$queries = max(1, $queries);
$queries = min(500, $queries);
$table = new Zend_Db_Table('World');
$worlds = array();
for ($i = 0; $i < $queries; $i += 1) {
$worlds[] = $table->fetchRow(array('id = ?' => mt_rand(1, 10000)))->toArray();
}
$this->_helper->json->sendJson($worlds);
}
示例10: addAction
public function addAction()
{
$form = new Application_Model_ContactForm(array('action' => '/contact/add', 'method' => 'POST'));
if ($this->getRequest()->isPost()) {
if ($form->isValid($this->getRequest()->getPost())) {
$contact = new Zend_Db_Table('contacts');
$data = array('name' => $this->_request->getPost('name'), 'email' => $this->_request->getPost('email'), 'type' => $this->_request->getPost('type'));
$contact->insert($data);
echo "<p>Contact added!</p>";
}
}
$this->view->form = $form;
}
示例11: filter
/**
* Returns id by name($value) from table
*
* @param string $value
* @return string
*/
public function filter($value)
{
if ($value === null) {
return null;
}
$select = $this->_table->select()->where($this->_field . ' = ?', $value);
$row = $this->_table->fetchRow($select);
if ($row !== null) {
return $row[reset($this->_table->info(Zend_Db_Table::PRIMARY))];
} else {
return null;
}
}
示例12: getTable
function getTable($name)
{
if (!($result = $this->_cache->load($this->_options[$name]['table']))) {
$table = new Zend_Db_Table($this->_options[$name]['table']);
if ($name == 'privilege') {
$sql = new Zend_Db_Select($table->getDefaultAdapter());
$sql->from(array('acl' => $this->_options['privilege']['table']), array('acl.ID_PERFIL'))->join(array('r' => $this->_options['resource']['table']), 'acl.ID_MENU=r.ID_MENU', array('r.URL_MENU', 'acl.PERMISO'));
$result = $table->getAdapter()->fetchAll($sql);
} else {
$result = $table->fetchAll();
}
$this->_cache->save($result, $this->_options[$name]['table']);
}
return $result;
}
示例13: _init
private function _init()
{
global $logger;
$oTable = new Zend_Db_Table('path');
foreach ($oTable->fetchAll($oTable->select())->toArray() as $xt) {
$this->_path[] = $xt['name'];
}
$oTable = new Zend_Db_Table('container');
$t = array();
foreach ($oTable->fetchAll($oTable->select())->toArray() as $xt) {
$t[] = $xt['name'];
}
$this->_extensions = implode(',', $t);
$logger->log('Valid extensions are : ' . $this->_extensions, Zend_Log::DEBUG);
}
示例14: getTableFields
public function getTableFields($tableName)
{
$db = Zend_Db_Table::getDefaultAdapter();
$columns = $db->query("SELECT menufields FROM main_menu WHERE url = '" . $tableName . "'");
$columnData = $columns->fetch();
return $columnData;
}
示例15: fillgridAction
public function fillgridAction()
{
$request = $this->getRequest();
$valid = $request->getParam('nd');
if ($valid) {
$this->grid = $this->_helper->grid();
$this->grid->sql = Zend_Db_Table::getDefaultAdapter()->select()->from('opac_issue_return', array('acc_no', 'member_id', 'title', 'author', 'edition', 'issue_date', 'return_date', 'isbn_id', 'status', 'issued_by', 'accepted_by'));
$searchOn = $request->getParam('_search');
if ($searchOn != 'false') {
$sarr = $request->getParams();
foreach ($sarr as $key => $value) {
switch ($key) {
case 'isbn_id':
case 'acc_no':
case 'edition':
case 'status':
case 'member_id':
case 'issued_by':
case 'accepted_by':
$this->grid->sql->where("{$key} = ?", $value);
break;
case 'title':
case 'author':
case 'issue_date':
case 'return_date':
$this->grid->sql->where("{$key} LIKE ?", '%' . $value . '%');
break;
}
}
}
self::fillgridfinal();
} else {
echo '<b>Oops!! </b><br/>No use of peeping like that.. :)';
}
}