コード例 #1
0
ファイル: connection.php プロジェクト: nikshade/fabrik21
 /**
  * Display the list of connections
  */
 function display()
 {
     $app =& JFactory::getApplication();
     $db =& JFactory::getDBO();
     // get the total number of records
     $db->setQuery("SELECT count(*) FROM #__fabrik_connections");
     $total = $db->loadResult();
     $context = 'com_fabrik.connection.list.';
     $limit = $app->getUserStateFromRequest($context . 'limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $sql = "SELECT *, u.name AS editor, #__fabrik_connections.id AS id FROM #__fabrik_connections " . "\n LEFT JOIN #__users AS u ON #__fabrik_connections.checked_out = u.id";
     $db->setQuery($sql, $limitstart, $limit);
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $rows = $db->loadObjectList();
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'connection.php';
     FabrikViewConenction::show($rows, $pageNav);
 }
コード例 #2
0
ファイル: connection.php プロジェクト: juliano-hallac/fabrik
    /**
     * edits a database connection
     * @param object connection
     */
    function edit($row)
    {
        JHtml::_('behavior.framework');
        FabrikViewConenction::setConnectionToolbar();
        JRequest::setVar('hidemainmenu', 1);
        $app =& JFactory::getApplication();
        $config =& JFactory::getConfig();
        if ($row->id == 1) {
            $app->enqueueMessage(JText::_('THIS IS THE ORIGINAL CONNECTION'));
            if (!($config->getValue('host') == $row->host && $config->getValue('user') == $row->user && $config->getValue('password') == $row->password && $config->getValue('db') == $row->database)) {
                JError::raiseWarning(E_WARNING, JText::_('YOUMUSTSAVETHISCNN'));
            }
            $row->host = $config->getValue('host');
            $row->user = $config->getValue('user');
            $row->password = $config->getValue('password');
            $row->database = $config->getValue('db');
        }
        ?>
		<form action="index.php" method="post" name="adminForm">
		<div class="col100">
			<fieldset class="adminform">
				<legend><?php 
        echo JText::_('DETAILS');
        ?>
</legend>
		<table class="admintable">
		<tbody>
			<tr>
				<td valign="top" class="key">
					<label for="description"><?php 
        echo JText::_('DESCRIPTION');
        ?>
</label>
				</td>
				<td><input class="inputbox" type="text" id="description" name="description" size="75" value="<?php 
        echo $row->description;
        ?>
" /></td>
			</tr>
			<tr>
				<td valign="top" class="key">
					<label for="host"><?php 
        echo JText::_('HOST');
        ?>
</label>
				</td>
				<td><input class="inputbox" type="text" id="host" name="host" size="75" value="<?php 
        echo $row->host;
        ?>
" /></td>
			</tr>
			<tr>
		<td valign="top" class="key">
			<label for="database"><?php 
        echo JText::_('DATABASE');
        ?>
</label>
		</td>
		<td><input class="inputbox" type="text" id="database" name="database" size="75" value="<?php 
        echo $row->database;
        ?>
" /></td>
			</tr>
			<tr>
				<td valign="top" class="key">
					<label for="user"><?php 
        echo JText::_('USER');
        ?>
</label>
				</td>
				<td><input class="inputbox" type="text" name="user" id="user" size="75" value="<?php 
        echo $row->user;
        ?>
" /></td>
			</tr>
			<?php 
        if ($row->host != "") {
            ?>
				<tr>
				<td valign="top" class="key"><?php 
            echo JText::_('ENTER PASSWORD OR LEAVE AS IS');
            ?>
</td>
				<td></td>
			</tr>
			<?php 
        }
        ?>
			<tr>
				<td valign="top" class="key">
					<label for="password"><?php 
        echo JText::_('PASSWORD');
        ?>
</label>
				</td>
				<td><input class="inputbox" type="password" id="password" name="password" size="20" value="<?php 
        echo $row->password;
        ?>
" /></td>
			</tr>
			<tr>
				<td valign="top" class="key">
					<label for="passwordConf"><?php 
        echo JText::_('CONFIRM PASSWORD');
        ?>
</label>
				</td>
				<td><input class="inputbox" type="password" id="passwordConf" name="passwordConf" size="20" value="<?php 
        echo $row->password;
        ?>
" /></td>
			</tr>
			<tr>
				<td valign="top" class="key"><label for="state"><?php 
        echo JText::_('PUBLISHED');
        ?>
</label></td>
				<td>
					<input type="checkbox" id="state" name="state" value="1" <?php 
        echo $row->state ? 'checked="checked"' : '';
        ?>
 />
				</td>
			</tr>
			<tbody>
		</table>
		<input type="hidden" name="option" value="com_fabrik" />
		<input type="hidden" name="task" value="save" />
		<input type="hidden" name="c" value="connection" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		</fieldset>
		</div>
		<?php 
        echo JHTML::_('form.token');
        echo JHTML::_('behavior.keepalive');
        ?>
	</form>
<?php 
    }