"Testimonials by FOSSEE Summer Fellows", "page callback" => "fellowship_testimonials_display_all", "access arguments" => array("view fellowship_testimonials"), "type" => MENU_CALLBACK );*/ $items["fellowship-testimonials"] = array( "title" => "Fellowship testimonials", "page callback" => "drupal_get_form", "page arguments" => array( "fellowship_testimonials_display_form" ), "access arguments" => array( "view fellowship_testimonials" ), "type" => MENU_NORMAL_ITEM ); $items["fellowship-testimonials/year-wise"] = array( "title" => "Testimonials by FOSSEE Summer Fellows year wise", "page callback" => "fellowship_testimonials_display_year_wise", "access arguments" => array("view fellowship_testimonials"), "type" => MENU_CALLBACK, 'file' => 'testimonials_year_wise.inc' ); $items["fellowship-testimonials/add"] = array( "title" => "Add fellowship testimonials", "page callback" => "fellowship_testimonials_add_all", "access arguments" => array("manage fellowship_testimonials"), "type" => MENU_CALLBACK, 'file' => 'testimonials_add.inc' ); $items["fellowship-testimonials/edit"] = array( "title" => "Edit fellowship testimonials", "page callback" => "fellowship_testimonials_edit_all", "access arguments" => array("manage fellowship_testimonials"), "type" => MENU_CALLBACK, 'file' => 'testimonials_edit.inc' ); $items["fellowship-testimonials/delete"] = array( "title" => "Delete Testimonial", "page callback" => "fellowship_testimonials_delete_all", "access arguments" => array("manage fellowship_testimonials"), "type" => MENU_CALLBACK ); return $items; } function fellowship_testimonials_permission() { return array( "view fellowship_testimonials" => array ( "title" => t("view fellowship_testimonials"), 'restrict access' => TRUE, ), "manage fellowship_testimonials" => array ( "title" => t("manage fellowship_testimonials"), 'restrict access' => TRUE, ), ); } function get_video_testimonials() { $page_content = ""; /*$query = " SELECT * FROM fellowship_testimonials ORDER BY id DESC "; $result = pager_query($query, 4, 0, "SELECT COUNT(*) FROM fellowship_testimonials");*/ $query = db_select('fellowship_testimonials'); $query->fields('fellowship_testimonials'); $query->condition('testimonial_type', 'V'); $query->orderBy('year', 'DESC'); //$result = $query->extend('PagerDefault')->limit(3)->execute(); $result = $query->execute(); $page_content .= "
"; while($row = $result->fetchObject()) { $speakerquery = db_select('fellows'); $speakerquery->fields('fellows'); $speakerquery->condition('t_id', $row->id); $speakerresult = $speakerquery->execute(); $page_content .= "
"; while($speakerrow = $speakerresult->fetchObject()){ $page_content .= "

{$speakerrow->name}
Institute: {$speakerrow->institute}, {$speakerrow->place}

"; } $page_content .= "Fellowship task: {$row->fellowship_task}

Fellowship Year: {$row->year}

"; } $page_content .= "
"; //$page_content .= theme("pager", NULL, 4, 0); $page_content .= theme('pager', array('header' => NULL, 'rows' => 4 )); return $page_content; } function get_text_testimonials() { $page_content = ""; /*$query = " SELECT * FROM fellowship_testimonials ORDER BY id DESC "; $result = pager_query($query, 4, 0, "SELECT COUNT(*) FROM fellowship_testimonials");*/ $query = db_select('fellowship_testimonials'); $query->fields('fellowship_testimonials'); $query->condition('testimonial_type', 'T'); $query->orderBy('year', 'DESC'); //$result = $query->extend('PagerDefault')->limit(3)->execute(); $result = $query->execute(); $page_content .= "
"; while($row = $result->fetchObject()) { $speakerquery = db_select('fellows'); $speakerquery->fields('fellows'); $speakerquery->condition('t_id', $row->id); $speakerresult = $speakerquery->execute(); $speakerrow = $speakerresult->fetchObject(); $page_content .= "

{$row->testimonial_text}

"; //while($speakerrow = $speakerresult->fetchObject()){ $page_content .= "

{$speakerrow->name}
{$speakerrow->institute}, {$speakerrow->place}
"; // } $page_content .= "{$row->fellowship_task}, FOSSEE Summer Fellowship {$row->year}

"; } $page_content .= "
"; //$page_content .= theme("pager", NULL, 4, 0); $page_content .= theme('pager', array('header' => NULL, 'rows' => 4 )); return $page_content; } function fellowship_testimonials_init() { drupal_add_css(drupal_get_path("module", "fellowship_testimonials") . "/css/fellowship_testimonials.css"); } function fellowship_testimonials_display_form($form, $form_state){ $form = array(); $form['tab_content'] = array( '#type' => 'item', '#markup' => '
' . get_text_testimonials() . '
' . get_video_testimonials() . '
' ); $form['lastdiv'] = array( '#type' => 'item', '#markup' => '', '#suffix' => '' ); return $form; }