All pastes #509427 Raw Edit

Jacob

public php v1 · immutable
·published 2007-05-25 13:28 UTC
rendered paste body
<?php$rowlimit=50;//Ok first did we get any variables? if ($_GET['type'] || $_GET['status']) {   //Alright we're filtering by a type and/or status   $sql = "SELECT node.nid as nid, node.title as title,       i18n_node.language as language, CASE i18n_node.status      WHEN  4 THEN 'Source Updated'      WHEN 3 THEN 'Translated Content'      WHEN 2 THEN 'Translation in Progress'      WHEN 1 THEN 'Source content'      WHEN 0 THEN 'None'      END  as status      FROM i18n_node       JOIN node on i18n_node.nid = node.nid ";    //Now lets figure out what we're filtering by     if ($_GET['type'] && ($_GET['status'] != null)) {       //both         $sql .= "WHERE node.type = '". mysql_escape_string($_GET['type'])."'                 AND i18n_node.status = '". mysql_escape_string($_GET['status'])."'";    } elseif ($_GET['type']) {        $sql .= "WHERE node.type = '". mysql_escape_string($_GET['type'])."'";    } elseif ($_GET['status']) {        $sql .= "WHERE i18n_node.status = '". mysql_escape_string($_GET['status'])."'";    }      $header = array(       array('data' => t("nid"), field=> 'node.title'),       array('data' => t("Title"), field=> 'node.title', 'sort' => asc),       array('data' => t("Language"), field=> 'language'),       array('data' => t("Status"), field=> 'status'),   );   $rows = array();   $tablesort = tablesort_sql($header);   $result = pager_query($sql . $tablesort, $rowlimit);    while ($row = mysql_fetch_array($result)) {        $rows[] = array(             $row['nid'],             "<a href=\"/node/". $row['nid']. "\">".             $row['title']."</a>",             $row['language'],             $row['status']         );   }   print "<a href=\"?\">Back to overview<br></a>";}else {   //Show it all $sql = " SELECT node.type as type, count(node.type) as number, (SELECT count(i18n.language) FROM i18n_node as i18n JOIN node as nd on i18n.nid = nd.nidWHERE nd.type = node.typeAND i18n.status = 4) as SourceUpdated,(SELECT count(i18n.language) FROM i18n_node as i18n JOIN node as nd on i18n.nid = nd.nidWHERE nd.type = node.typeAND i18n.status = 3) as Translated_Content,(SELECT count(i18n.language) FROM i18n_node as i18n JOIN node as nd on i18n.nid = nd.nidWHERE nd.type = node.typeAND i18n.status = 2) as Translation_in_progress,(SELECT count(i18n.language) FROM i18n_node as i18n JOIN node as nd on i18n.nid = nd.nidWHERE nd.type = node.typeAND i18n.status = 1) as Source_Content,(SELECT count(i18n.language) FROM i18n_node as i18n JOIN node as nd on i18n.nid = nd.nidWHERE nd.type = node.typeAND i18n.status = 0) as NoneFROM i18n_nodeJOIN node on i18n_node.nid = node.nidGROUP BY node.type";//lets throw the data into a table$header=array(       array('data' => t("Type"), field=> 'node.type', 'sort' => asc),       array('data' => t("# of Nodes"), field=> 'number'),       array('data' => t("Source Updated"), field=> 'SourceUpdated'),       array('data' => t("Translated Content"), field=> 'Translated_Content'),       array('data' => t("Translation in Progress"), field=> 'Translation_in_progress'),       array('data' => t("Source Content"), field=> 'Source_Content'),       array('data' => t("None"), field=> 'None')       );$tablesort = tablesort_sql($header);$result = pager_query($sql . $tablesort, $rowlimit); $rows = array();while ($row = mysql_fetch_array($result)) {    $rows[] = array(       "<a href=\"?type=".$row['type']."\">".$row['type']."</a>",       "<a href=\"?type=".$row['type']."\">".$row['number']."</a>",       "<a href=\"?status=4&type=".$row['type']."\">".$row['SourceUpdated']."</a>",       "<a href=\"?status=3&type=".$row['type']."\">".$row['Translated_Content']."</a>",       "<a href=\"?status=2&type=".$row['type']."\">".$row['Translation_in_progress']."</a>",       "<a href=\"?status=1&type=".$row['type']."\">".$row['Source_Content']."</a>",       "<a href=\"?status=0&type=".$row['type']."\">".$row['None']."</a>",    );  }}$output .= theme('table', $header, $rows);$output .= theme('pager', NULL, $limit, 0);//$table = theme_table($header,$rows);print $output;?>