Example #1
0
 public function index($cmd)
 {
     $path = JPATH_SITE . '/components/com_acctexp/toolbox';
     if (empty($cmd)) {
         $list = array();
         $files = xJUtility::getFileArray($path, 'php', false, true);
         asort($files);
         foreach ($files as $n => $name) {
             $file = $path . '/' . $name;
             include_once $file;
             $class = str_replace('.php', '', $name);
             $tool = new $class();
             if (!method_exists($tool, 'Info')) {
                 continue;
             }
             $info = $tool->Info();
             $info['link'] = AECToolbox::deadsureURL('administrator/index.php?option=com_acctexp&task=index&entity=toolbox&cmd=' . $class);
             $list[] = $info;
         }
         HTML_AcctExp::toolBox('', $list);
     } else {
         $file = $path . '/' . $cmd . '.php';
         include_once $file;
         $tool = new $cmd();
         $info = $tool->Info();
         $return = '';
         if (!method_exists($tool, 'Action')) {
             $return .= '<section class="paper">' . '<p>Tool doesn\'t have an action to carry out!</p>' . '</section>';
         } else {
             $response = '</section><section class="paper"><h4>' . JText::_('Response') . '</h4>' . $tool->Action() . '</section>';
             if (method_exists($tool, 'Settings')) {
                 $tb_settings = $tool->Settings();
                 if (!empty($tb_settings)) {
                     $lists = array();
                     if (isset($tb_settings['lists'])) {
                         $lists = $tb_settings['lists'];
                         unset($tb_settings['lists']);
                     }
                     // Get preset values from POST
                     foreach ($tb_settings as $n => $v) {
                         if (isset($_POST[$n])) {
                             $tb_settings[$n][3] = $_POST[$n];
                         }
                     }
                     $settings = new aecSettings('TOOLBOX', 'E');
                     $settings->fullSettingsArray($tb_settings, array(), $lists);
                     // Call HTML Class
                     $aecHTML = new aecHTML($settings->settings, $settings->lists);
                     foreach ($tb_settings as $n => $v) {
                         $return .= $aecHTML->createSettingsParticle($n);
                     }
                     $return .= '<input type="submit" class="btn btn-primary pull-right"/><br/><br/>';
                 }
             }
             $return .= $response;
         }
         HTML_AcctExp::toolBox($cmd, $return, $info['name']);
     }
 }
Example #2
0
    /**
     * @param aecHTML $aecHTML
     * @param ItemGroup $row
     */
    static function editItemGroup($aecHTML, $row)
    {
        HTML_myCommon::startCommon('aec-wrap-squary', 'aec-wrap-inner-light');
        HTML_myCommon::startForm();
        HTML_myCommon::getHeader('AEC_HEAD_ITEMGROUP_INFO', 'itemgroups', $row->id ? $row->name : JText::_('AEC_CMN_NEW'), false, 'edit', 'ItemGroup');
        ?>
<div class="col-sm-12"><?php 
        $tabs = new bsPaneTabs();
        $tabs->startTabs();
        $tabs->newTab('group', JText::_('ITEMGROUP_DETAIL_TITLE'));
        $tabs->newTab('restrictions', JText::_('ITEMGROUP_RESTRICTIONS_TITLE'));
        $tabs->newTab('mis', JText::_('AEC_USER_MICRO_INTEGRATION'));
        $tabs->endTabs();
        $tabs->startPanes();
        $tabs->nextPane('group');
        ?>
		<div class="row">
			<div class="col-sm-4">
				<section class="paper">
					<h4>General</h4>
					<?php 
        echo $aecHTML->createSettingsParticle('active');
        ?>
					<?php 
        echo $aecHTML->createSettingsParticle('visible');
        ?>
					<?php 
        echo $aecHTML->createSettingsParticle('color');
        ?>
					<div style="position:relative;width:100%;">
						<?php 
        echo $aecHTML->createSettingsParticle('name');
        if ($row->id) {
            ?>
							<p><a href="<?php 
            echo str_replace("/administrator/", "/", AECToolbox::deadsureURL('index.php?option=com_acctexp&task=subscribe&group=' . $row->id));
            ?>
" title="<?php 
            echo JText::_('AEC_CGF_LINK_ABO_FRONTEND');
            ?>
" target="_blank"><?php 
            echo JText::_('AEC_CGF_LINK_ABO_FRONTEND');
            ?>
</a></p>
						<?php 
        }
        ?>
					</div>
				</section>
				<section class="paper">
					<h4><?php 
        echo JText::_('ITEMGROUPS_PARENTGROUP_TITLE');
        ?>
</h4>
					<?php 
        if ($row->id > 1) {
            ?>
						<table style="width:100%;" class="table table-striped table-hover table-condensed aec-grouplist">
							<thead>
							<tr>
								<th>Name</th>
								<th></th>
							</tr>
							</thead>
							<tbody>
							<?php 
            if (!empty($aecHTML->customparams->groups)) {
                foreach ($aecHTML->customparams->groups as $id => $group) {
                    HTML_AcctExp::groupRow('group', $group);
                }
            }
            ?>
							</tbody>
							<tfoot>
							<tr>
								<td><?php 
            echo $aecHTML->createSettingsParticle('add_group');
            ?>
</td>
								<td>
									<a class="btn btn-success pull-right" id="addgroup-btn" onClick="addGroup('group','addgroup-btn')"><?php 
            echo aecHTML::Icon('plus');
            ?>
</a>
								</td>
							</tr>
							</tfoot>
						</table>
					<?php 
        } elseif ($row->id == 1) {
            ?>
						<p>This is the Root Group.</p>
					<?php 
        } else {
            ?>
						<p>You can select Parent Groups after you have saved this for the first time.</p>
					<?php 
        }
        ?>
				</section>
			</div>
			<div class="col-sm-8">
				<section class="paper">
					<h4>Details</h4>
					<?php 
        echo $aecHTML->createSettingsParticle('reveal_child_items');
        ?>
					<?php 
        echo $aecHTML->createSettingsParticle('symlink');
        ?>
					<?php 
        echo $aecHTML->createSettingsParticle('symlink_userid');
        ?>
					<?php 
        echo $aecHTML->createSettingsParticle('notauth_redirect');
        ?>
					<?php 
        echo $aecHTML->createSettingsParticle('desc');
        ?>
				</section>
			</div>
		</div>
		<?php 
        $tabs->nextPane('restrictions');
        ?>
		<?php 
        echo aecRestrictionHelper::echoSettings($aecHTML);
        ?>
		<?php 
        $tabs->nextPane('mis');
        ?>
		<div class="row">
			<div class="col-sm-6">
				<section class="paper">
					<h4><?php 
        echo JText::_('Inherited Micro Integrations');
        ?>
</h4>
					<?php 
        if ($row->id > 1) {
            if (!empty($aecHTML->customparams->mi['inherited'])) {
                echo '<p>' . JText::_('These MIs were inherited from groups that this group is in') . '</p>';
                echo '<ul>';
                foreach ($aecHTML->customparams->mi['inherited'] as $id => $mi) {
                    ?>
								<li>
									<p>
										<input type="checkbox" name="inherited_micro_integrations[]" value="<?php 
                    echo $mi->id;
                    ?>
" checked="checked" disabled="disabled" />
										<strong><?php 
                    echo $mi->name;
                    ?>
</strong> (#<?php 
                    echo $mi->id;
                    ?>
)
										(<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=microintegration&amp;id=<?php 
                    echo $mi->id;
                    ?>
" target="_blank"><?php 
                    echo JText::_('edit');
                    ?>
</a>)
									</p>
									<p><?php 
                    echo $mi->desc;
                    ?>
</p>
								</li>
							<?php 
                }
                echo '</ul>';
            } else {
                echo '<p>' . JText::_('No inherited MIs - A group can inherit MIs from groups that it is in') . '</p>';
            }
        }
        ?>
				</section>
			</div>

			<div class="col-sm-6">
				<section class="paper">
					<h4><?php 
        echo JText::_('Attached Micro Integrations');
        ?>
</h4>
					<?php 
        if (!empty($aecHTML->customparams->mi['attached'])) {
            echo '<table style="margin: 0 auto;">';
            foreach ($aecHTML->customparams->mi['attached'] as $id => $mi) {
                ?>
							<tr>
								<td>
									<h5>
										<strong><?php 
                echo $mi->name;
                ?>
</strong>
										(#<?php 
                echo $mi->id;
                ?>
)
										<?php 
                echo $mi->inherited ? ' (' . JText::_('inherited from group, see above') . '!)' : '';
                ?>
										(<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=microintegration&amp;id=<?php 
                echo $mi->id;
                ?>
" target="_blank"><?php 
                echo JText::_('edit');
                ?>
</a>)
									</h5>
								</td>
								<td>
									<input type="hidden" name="micro_integrations[]" value="0" />
									<input id="micro_integrations_<?php 
                echo $mi->id;
                ?>
" class="bootstrap-toggle" type="checkbox" name="micro_integrations[]"<?php 
                echo $mi->attached ? ' checked="checked"' : '';
                ?>
 value="<?php 
                echo $mi->id;
                ?>
" data-state="<?php 
                echo $mi->attached ? '1' : '0';
                ?>
"/>
								</td>
							</tr>
							<tr>
								<td colspan="2" style="border-bottom: 1px dashed #999;">
									<p><?php 
                echo $mi->desc;
                ?>
</p>
								</td>
							</tr>
						<?php 
            }
            echo '</table>';
        } else {
            echo '<p>' . JText::_('No MIs to attach') . '<a href="index.php?option=com_acctexp&amp;task=edit&amp;entity=microintegration" target="_blank">(' . JText::_('create one now?') . ')</a></p>';
        }
        ?>
				</section>
			</div>
		</div>
		<?php 
        $tabs->endPanes();
        ?>
		<br />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="option" value="com_acctexp" />
		<input type="hidden" name="entity" value="ItemGroup" />
		<input type="hidden" name="task" value="save" />
		</form>

		</div>

		<?php 
        HTML_myCommon::endCommon();
    }