Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function getRandomIdsNotInPivot(array $entities, array $idEntities, array $ids, $count)
 {
     // the table to retrieve ids from
     $table = last($entities);
     $pivotTable = $this->tableHelper->getTable($entities);
     $pivotColumn = $this->tableHelper->getLastEntityAsIdColumnName($entities);
     $columnNames = $this->tableHelper->getIdColumnNames($entities, $idEntities);
     if (count($entities) === count($ids)) {
         array_pop($ids);
     }
     $pivotWhereJoinColumns = array_combine($columnNames, $ids);
     return $this->db->getRandomIdsFromTableWhereNotInPivot($table, $pivotTable, $pivotColumn, $count, $pivotWhereJoinColumns);
 }
Beispiel #2
0
 /**
  * Gets the model class of the said table.
  *
  * @param  string|object $tableName
  * @return array
  */
 public static function createInstance($tableName)
 {
     if (is_object($tableName)) {
         return [TableHelper::getNameFromModel($tableName), $tableName];
     }
     $modelName = TableHelper::getModelName($tableName);
     $newModel = new $modelName();
     return [TableHelper::getNameFromModel($newModel), $newModel];
 }
                    }
                    ?>
                        <?php 
                }
                ?>

                    <?php 
            } else {
                ?>

                        <?php 
                foreach ($row as $key => $value) {
                    ?>
                            <?php 
                    if (isset($tableValueConversions)) {
                        $convertedValue = TableHelper::convertField($value, Arrays::element($key, $tableValueConversions));
                    } else {
                        $convertedValue = $value;
                    }
                    ?>

                            <?php 
                    if (!isset($tableIgnoreFields) || !in_array($key, $tableIgnoreFields)) {
                        ?>
                                <?php 
                        if (!isset($tableLinks)) {
                            ?>
                                    <td><?php 
                            echo $convertedValue;
                            ?>
</td>
Beispiel #4
0
$profiles = $profile_model->All();
global $database;
$data = array();
foreach ($profiles as $pro) {
    $a = $auth_model->byProfile($pro['ID']);
    $link_title = "Send mail to " . $pro['first_name'] . ' ' . $pro['last_name'] . ' or right click to copy URL\'s email address';
    $access = '';
    $acls = explode(",", $a['acl']);
    foreach ($acls as $ac) {
        if (strlen($level = trim($ac)) > 0) {
            $access .= '<span class="acl">' . $ac . '</span>';
        }
    }
    $data[] = array($a['username'], $pro['first_name'] . ' ' . $pro['last_name'], '<a href="mailto:' . $pro['email'] . '" title="' . $link_title . '" alt="' . $link_title . '" class="bare">' . $pro['email'] . '</a>', $access, Auth::ACL("admin") || Auth::ACL("su") ? '<a class="buttonsmred margined" title="Edit User: '******'username'] . '" href="profile.edit?ID=' . $a['ID'] . '"><span class="fi-page-edit"></span></a>' : '');
}
$table = new TableHelper(array('table' => "table wide", 'thead' => "tablehead", 'th' => "tablehead", 'td' => "tablecell", 'headings' => array('Username', 'Name', 'Email', 'Access', '&nbsp;'), 'data' => $data));
$table->Render($table);
$html = '<span class="breadcrumbs">Leaderboard</span>';
$html .= '<div class="formboundary">';
$html .= $table;
$html .= '</div>';
$p->HTML($html);
$counted = count($profile_model->All());
if ($counted >= $page_limit) {
    Pager($p, "profiles?", $getpost['start'], $page_limit, $counted);
}
$p->HTML('<a class="buttonlink" href="profile.new">+ Add User Account</a>');
// Footer
if (!$p->ajax) {
    $p->HTML('footer.html');
}
Beispiel #5
0
 /**
  * Render the table and pass the output back.
  * This is done this way because the table
  * helper dumps everything to the output and
  * there is no way to catch so have to override
  * with a special output.
  *
  * @return string
  */
 public function __toString()
 {
     $this->table->render($this->output);
     return rtrim($this->output->written());
     // Remove trailing \n
 }
 /**
  * @return array
  */
 public function getData()
 {
     $this->viewData = $this->_tableHelper->getTableOptions();
     return parent::getData();
 }