本文整理汇总了PHP中JTable::load方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::load方法的具体用法?PHP JTable::load怎么用?PHP JTable::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unserialize
/**
* Get a connection table object
*
* @param int $id connection id
*
* @return object connection tables
*/
public function &getConnection($id = null)
{
if (!is_null($id)) {
$this->setId($id);
}
if (!is_object($this->_connection)) {
$session = JFactory::getSession();
$key = 'fabrik.connection.' . $this->_id;
if ($session->has($key)) {
$connProperties = unserialize($session->get($key));
// $$$ rob since J1.6 - connection properties stored as an array (in f2 it was an object)
if (is_a($connProperties, '__PHP_Incomplete_Class') || JArrayHelper::getValue($connProperties, 'id') == '') {
$session->clear($key);
} else {
$this->_connection = FabTable::getInstance('connection', 'FabrikTable');
$this->_connection->bind($connProperties);
return $this->_connection;
}
}
if ($this->_id == -1 || $this->_id == '') {
$this->_connection = $this->loadDefaultConnection();
} else {
$this->_connection = FabTable::getInstance('Connection', 'FabrikTable');
$this->_connection->load($this->_id);
}
// $$$ rob store the connection for later use as it may be required by modules/plugins
$session->set($key, serialize($this->_connection->getProperties()));
}
return $this->_connection;
}
示例2: loadByVersion
/**
* Load the audience for a publication by version id
*
* @param integer $versionid Pub version ID
* @return mixed False if error, Object on success
*/
public function loadByVersion($versionid = NULL)
{
if ($versionid === NULL) {
return false;
}
return parent::load(array('publication_version_id' => (int) $versionid));
}
示例3: load
/**
* Method to load a row from the database by primary key and bind the fields
* to the JTable instance properties.
*
* @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not
* set the instance property value is used.
* @param boolean $reset True to reset the default values before loading the new row.
*
* @return boolean True if successful. False if row not found or on error (internal error state set in that case).
*
* @link http://docs.joomla.org/JTable/load
* @since 11.1
*/
public function load($keys = null, $reset = true)
{
parent::load($keys, $reset);
$this->slug = $this->id . "." . $this->alias;
// Calculate funded percent
if (!$this->goal) {
$this->fundedPercent = 0;
} else {
$percentage = new Prism\Math();
$percentage->calculatePercentage($this->funded, $this->goal, 0);
$this->fundedPercent = (string) $percentage;
}
// Calculate end date
if (!empty($this->funding_days)) {
$fundingStartDateValidator = new Prism\Validator\Date($this->funding_start);
if (!$fundingStartDateValidator->isValid()) {
$this->funding_end = "0000-00-00";
} else {
$fundingStartDate = new Crowdfunding\Date($this->funding_start);
$fundingEndDate = $fundingStartDate->calculateEndDate($this->funding_days);
$this->funding_end = $fundingEndDate->toSql();
}
}
// Calculate days left
$today = new Crowdfunding\Date();
$this->daysLeft = $today->calculateDaysLeft($this->funding_days, $this->funding_start, $this->funding_end);
return true;
}
示例4: load
function load($id = null)
{
parent::load($id);
jimport('joomla.html.parameter');
$params = new JParameter($this->settings);
$this->settings = $params->toArray();
}
示例5: load
/**
* Method to load a row from the database by primary key and bind the fields
* to the JTable instance properties.
*
* @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not set the instance property value is used.
* @param boolean $reset True to reset the default values before loading the new row.
* @return boolean True if successful. False if row not found or on error (internal error state set in that case).
*/
public function load($keys = null, $reset = true)
{
if (is_numeric($keys)) {
return parent::load($keys, $reset);
}
return parent::load(array('alias' => $keys), $reset);
}
示例6: load
public function load($key = null, $permalink = false)
{
static $loaded = array();
$sig = $key . (int) $permalink;
$doBind = true;
if (!isset($loaded[$sig])) {
if (!$permalink) {
parent::load($key);
$loaded[$sig] = $this;
//return $this->id;
} else {
$db = DiscussHelper::getDBO();
$query = 'SELECT ' . $db->nameQuote('id') . ' FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('alias') . '=' . $db->Quote($key);
$db->setQuery($query);
$id = $db->loadResult();
// Try replacing ':' to '-' since Joomla replaces it
if (!$id) {
$query = 'SELECT id FROM ' . $this->_tbl . ' ' . 'WHERE alias=' . $db->Quote(JString::str_ireplace(':', '-', $key));
$db->setQuery($query);
$id = $db->loadResult();
}
parent::load($id);
$loaded[$sig] = $this;
}
$doBind = false;
}
if ($doBind) {
return parent::bind($loaded[$sig]);
} else {
return $this->id;
}
}
示例7: getRow
/**
* Get db row/item loaded with id
*
* @return JTable
*/
protected function getRow()
{
if (!isset($this->row)) {
$this->row = $this->getTable($this->_type);
$this->row->load($this->id);
}
return $this->row;
}
示例8: testPublish
/**
* Test the publish method.
*
* @return void
*
* @since 12.3
*/
public function testPublish()
{
$this->object->publish(array(array('id1' => 25, 'id2' => 50), array('id1' => 25, 'id2' => 51)), 2);
$this->object->load(array('id1' => 25, 'id2' => 50));
$this->assertEquals(2, $this->object->published);
$this->object->load(array('id1' => 25, 'id2' => 51));
$this->assertEquals(2, $this->object->published);
}
示例9: load
/**
* Load by post id. Return Only ONE latest record
*/
public function load($keys = null, $reset = true)
{
$db = DiscussHelper::getDBO();
$query = 'SELECT id FROM `#__discuss_assignment_map` WHERE `post_id` = ' . $db->quote($keys) . ' ORDER BY `created` DESC LIMIT 0, 1';
$db->setQuery($query);
$result = $db->loadResult();
return parent::load($result, $reset);
}
示例10: load
public function load($oid = null)
{
$ret = parent::load($oid);
if ($ret === true) {
$this->_exists = true;
}
return $ret;
}
示例11: load
public function load($keys = null, $reset = true)
{
if (K2_JVERSION == '15') {
return parent::load($keys);
} else {
return parent::load($keys, $reset);
}
}
示例12: loadByIp
/**
* Load a record and bind to $this
*
* @param integer $response_id Answer ID
* @param string $ip IP address
* @return boolean True upon success, False if errors
*/
public function loadByIp($response_id = null, $ip = null)
{
$response_id = $response_id ?: $this->response_id;
if ($response_id == null) {
return false;
}
return parent::load(array('response_id' => (int) $response_id, 'ip' => (string) $ip));
}
示例13: load
/**
* Override parent's load behavior as we need to attach messageTable here.
*
* @since 3.0
* @access public
*/
public function load($id = null, $ignore = array())
{
$state = parent::load($id);
if (!$state) {
return $state;
}
return $state;
}
示例14: load
/**
* Method to load a row from the database by primary key and bind the fields
* to the JTable instance properties.
*
* @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not
* set the instance property value is used.
* @param boolean $reset True to reset the default values before loading the new row.
*
* @return boolean True if successful. False if row not found.
*
* @link http://docs.joomla.org/JTable/load
* @since 11.1
* @throws RuntimeException
* @throws UnexpectedValueException
*/
public function load($keys = null, $reset = true)
{
$result = parent::load($keys, $reset);
if ($result) {
$this->tags = new JHelperTags();
$this->tags->getTagIds($this->id, 'com_webgallery.item');
}
return $result;
}
示例15: load
function load($oid = null)
{
$ret = parent::load($oid);
if ($ret === true) {
$this->_exists = true;
}
$this->userid = (int) $oid;
return $ret;
}