Project: Box2D_friction_mod      WheelConstraint.h      box2d_friction_joint.patch      b2FrictionJoint.h      TopDownCar.h      b2FrictionJoint.cpp      TestEntries.cpp      python_friction_joint.patch     

Project: jvfeatures

jvtypes.h      jvtypes.cpp      jvfeatures.h      chessSeg.cpp      jvtest.cpp      jvfeatures.cpp     

Project: Other


Project: Infinite HMM Tutorial

HMMProblem.m      HMM.m      README.txt      HDP.m      HDP_HMM.m      run.m      ConditionalProbabilityTable.m     

Project: Arduino_Code

arduino-serial.c      oscilloscope.pde      ranger_test.pde      accelerometer_test.pde      pwm_manual.pde      servo_test.pde      motordriver.pde      ranger_plane_sweep.pde      helicopter_controller.pde      clodbuster_controller.pde     

Project: RRT

BidirectionalRRT.cpp      RRT.tgz      AbstractRRT.cpp      RRT.h      RRT.cpp      rrt_test.cpp     

Project: ArduCom     

Project: Dirichlet Process Mixture Tutorial

EM_GM.m      DP_Demo.m      DirichletProcess.m      DPMM.m      gaussian_EM.m     

Project: support

Protector.php      geshi.php     

Project: Cogent

CodePane.php      Cogent.php      NotesPane.php      PubsTable.php      PicsPane.php     
Click here to download "resources/site-code//Cogent/PubsTable.php"


* PubsTable
* A class for generating HTML tables of publication PDFs by scanning directories
* containing folders of PDF files.  For each directory found, PubsTable
* will add an album (top-level div) with a heading of that name.
* Outline:
* PicsPane("<directory name>")
* PicsPane->run();      // generates HTML output for all images found, organized by album
* Author: Jonathan Scholz
* 2/3/2010

class PubsTable extends Cogent
        * Like the list_content() function in the base class, except fancier.  Instead
        * of just returning the filtered list of files found, this function creates a
        * dictionary of fields for information from the filename, and returns an array
        * containing both the raw filename and the dictionary of parsed information as a
        * tuple (array)
        * Both arrays within this tuple are sorted by the date field of the parsed filenames

public function list_and_parse($dir) {
        // The delimiters for parsing filenames
        $tokens = "()";

        $hndl = opendir($dir);
        if ($hndl == false) {
                print "Could not find directory $dir";
        } else {
                while (false !== ($item = readdir($hndl))) {
                        // Get file extension
                        $ext = substr(strrchr($item, '.'), 1);

                        // Match against filter
                        if (Cogent::in_arrayi($ext, $this->filters)) {
                                // Extract tokens (hard coded tokens for now)
                                $items_toks[] = array("author" => strtok($item, $tokens),
                                        "date" => strtok($tokens),
                                        "title" => strtok($tokens),
                                        "journal" => strtok($tokens));
                                $items[] = $item;
                closedir($hndl); // close directory

                // Now sort both arrays by the "date" key
                if (isset($items) && count($items)!=0) {
                        foreach ($items_toks as $key => $row) {
                                // Create an array of dates, in the order they appear originally
                                $dates[$key] = $row['date'];
                        // Sort the full names (items) and the tokenized array by ascending $dates elements
                        return array($items, $items_toks);

* Generates HTML for a table of publications organized by category

protected function generate($dir, $files){
        print '<table class="pubs">'."\n\n";
        // Fetch PDFs & parse
        $all_PDF_info = $this->list_and_parse($this->rootdir."/".$dir);

        // Write out the section heading
        print '<tr><td class="pubs_section">'.$dir.'</td>';
        print '<td style="text-align: center;">download</td></tr>';
        if (count($all_PDF_info[0])==0) {
                print '<tr><td class="pubs_entry_disc">Working on it...</td>';
                print '<td class="pubs_entry_link"></td></tr>'."\n\n"; // print second cell
        else {
                for ($paper=0; $paper < count($all_PDF_info[0]); $paper++) {
                        // write the table row and start the text column:
                        print '<tr><td class="pubs_entry_disc">';

                        // write the authors:
                        print $all_PDF_info[1][$paper]['author'];

                        // write the date:
                        print "(".$all_PDF_info[1][$paper]['date'].")";

                        //write the title (in bold):
                        print "<strong>".$all_PDF_info[1][$paper]['title']."</strong>";

                        //write the journal (in parens):
                        print "<i>".$all_PDF_info[1][$paper]['journal']."</i>";
                        //close td:
                        print '</td>'."\n";

                        // Write the link to the actual file, which is the 1st element of the main info array
                        print '<td class="pubs_entry_link"><a href="'.
                        $this->rootdir."/".$dir."/".$all_PDF_info[0][$paper].'" '.              //  set target
                        'onClick="_gaq.push([\'_trackEvent\', \'Publication\', \'Downloaded\', \''.$all_PDF_info[0][$paper].'\']);">'. // install tracker
                        '<img src="resources/icons/pdf-icon.jpg" /></a></td></tr>'."\n\n";
        print '</table>'."\n";
} // End: class PubsTable


About me

Pic of me