Esempio n. 1
0
    $admin = true;
    // Fetch the form instance specified by submitted modin value.
    $userlist = new UserDataSet($dbcon, $_REQUEST['modin'], $admin);
    /* Output the file
     */
    $userlist->unregisterPlugin('Pager', 'Output');
    $search_form = $userlist->getPlugins('SearchForm');
    $search = $userlist->getPlugins('Search');
    if (!$search_form) {
        $userlist->registerPlugin('Output', 'SearchForm');
    }
    if (!$search) {
        $userlist->registerPlugin('AMP', 'Search');
    }
    set_time_limit(150);
    if ($output = $userlist->doPlugin('Output', 'ExportFile')) {
        print $output;
    } else {
        $show_template = true;
        $flash = AMP_System_Flash::instance();
        $renderer = AMP_get_renderer();
        $error_message = sprintf(AMP_TEXT_ERROR_FAILED, AMP_TEXT_EXPORT);
        $error_message .= $renderer->newline() . join($renderer->newline(), $userlist->errors);
        $flash->add_error($error_message);
    }
} else {
    $show_template = true;
    $error_message = sprintf(AMP_TEXT_ERROR_ACTION_NOT_ALLOWED, AMP_TEXT_EXPORT);
    $flash->add_error($error_message);
    $output = $error_message;
}
Esempio n. 2
0
    function petition_signers()
    {
        require_once 'AMP/UserData/Set.inc.php';
        $udm = new UserDataSet($this->dbcon, $this->getFormId());
        if ($list_plugin = $udm->getPlugin('Output', 'List')) {
            trigger_error(get_class($list_plugin));
            return $udm->doPlugin('Output', 'List');
        }
        $offset = 0;
        if (isset($_REQUEST['offset']) && $_REQUEST['offset']) {
            $offset = $_REQUEST['offset'];
        }
        $sql = "SELECT First_Name, Last_Name, Company, Notes, City, State FROM userdata where modin = " . $this->getFormId() . " and custom19 = 1 order by id desc  Limit {$offset}, " . $this->limit;
        $P = $this->dbcon->CacheExecute($sql) or die("could not find signers " . $sql . $this->dbcon->ErrorMsg());
        $sql = "SELECT  COUNT(*) FROM userdata  where modin = " . $this->getFormId() . " and custom19 =1";
        $ptct = $this->dbcon->CacheExecute($sql) or die("could not get count: " . $sql . $this->dbcon->ErrorMsg());
        $count = $ptct->fields[0];
        $html .= '<a name="namelist"></a>
				<p class="title">Recent Petition Signers</p>
				<table width="100%" border="0" cellspacing="0" cellpadding="3">
				  <tr bgcolor="#CCCCCC"> 
					<td class="text">Name</td>
					<td class="text">Organization</td>
					<td class="text">Location</td>
					<td class="text">Comment</td>
				  </tr>';
        while (!$P->EOF) {
            $html .= '
					  <tr> 
						<td class="text">' . trim($P->Fields("First_Name")) . '&nbsp;' . trim($P->Fields("Last_Name")) . '</td>
						<td class="text">' . $P->Fields("Company") . '</td>
						<td class="text">' . $P->Fields("City") . '&nbsp;' . $P->Fields("State") . '</td>
						<td class="text">' . $P->Fields("Notes") . '</td>
					  </tr>';
            $P->MoveNext();
        }
        if ($count > $this->limit) {
            $html .= '<tr><div align=right><td colspan=4 class="text"><a href="petition.php?pid=' . $this->id . '&signers=1&offset=' . ($offset + $this->limit) . '#namelist">Next Page</a></div></td></tr>';
        }
        $html .= '</table><P><a href="petition.php?pid=' . $this->id . '">Sign the Petition</a></P><br><br>';
        return $html;
    }