\n"; $retval .= "
\n"; $retval .= " \n"; $retval .= " " . PMA_RTE_getWord('title') . "\n"; $retval .= " " . PMA_Util::showMySQLDocu(PMA_RTE_getWord('docu')) . "\n"; $retval .= " \n"; $retval .= "
\n"; $retval .= " " . PMA_RTE_getWord('nothing') . "\n"; $retval .= "
\n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; // th cells with a colspan need corresponding td cells, according to W3C switch ($type) { case 'routine': $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; // see comment above for ($i = 0; $i < 7; $i++) { $retval .= " \n"; } break; case 'trigger': $retval .= " \n"; if (empty($table)) { $retval .= " \n"; } $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; // see comment above for ($i = 0; $i < (empty($table) ? 7 : 6); $i++) { $retval .= " \n"; } break; case 'event': $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; // see comment above for ($i = 0; $i < 6; $i++) { $retval .= " \n"; } break; default: break; } $retval .= " \n"; $retval .= " \n"; $ct = 0; foreach ($items as $item) { $rowclass = ($ct % 2 == 0) ? 'odd' : 'even'; if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) { $rowclass .= ' ajaxInsert hide'; } // Get each row from the correct function switch ($type) { case 'routine': $retval .= PMA_RTN_getRowForList($item, $rowclass); break; case 'trigger': $retval .= PMA_TRI_getRowForList($item, $rowclass); break; case 'event': $retval .= PMA_EVN_getRowForList($item, $rowclass); break; default: break; } $ct++; } $retval .= "
" . __('Name') . "" . __('Action') . "" . __('Type') . "" . __('Returns') . "
" . __('Name') . "" . __('Table') . "" . __('Action') . "" . __('Time') . "" . __('Event') . "
" . __('Name') . "" . __('Status') . "" . __('Action') . "" . __('Type') . "
\n"; $retval .= "
\n"; $retval .= "\n"; return $retval; } // end PMA_RTE_getList() /** * Creates the contents for a row in the list of routines * * @param array $routine An array of routine data * @param string $rowclass Empty or one of ['even'|'odd'] * * @return string HTML code of a row for the list of routines */ function PMA_RTN_getRowForList($routine, $rowclass = '') { global $ajax_class, $url_query, $db, $titles; $sql_drop = sprintf( 'DROP %s IF EXISTS %s', $routine['ROUTINE_TYPE'], PMA_Util::backquote($routine['SPECIFIC_NAME']) ); $type_link = "item_type={$routine['ROUTINE_TYPE']}"; $retval = " \n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($sql_drop) . "\n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($routine['SPECIFIC_NAME']) . "\n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; if ($routine['ROUTINE_DEFINITION'] !== null && PMA_Util::currentUserHasPrivilege('ALTER ROUTINE', $db) && PMA_Util::currentUserHasPrivilege('CREATE ROUTINE', $db) ) { $retval .= ' ' . $titles['Edit'] . "\n"; } else { $retval .= " {$titles['NoEdit']}\n"; } $retval .= " \n"; $retval .= " \n"; // There is a problem with PMA_Util::currentUserHasPrivilege(): // it does not detect all kinds of privileges, for example // a direct privilege on a specific routine. So, at this point, // we show the Execute link, hoping that the user has the correct rights. // Also, information_schema might be hiding the ROUTINE_DEFINITION // but a routine with no input parameters can be nonetheless executed. // Check if he routine has any input parameters. If it does, // we will show a dialog to get values for these parameters, // otherwise we can execute it directly. $routine_details = PMA_RTN_getDataFromName( $routine['SPECIFIC_NAME'], $routine['ROUTINE_TYPE'], false ); if ($routine !== false) { $execute_action = 'execute_routine'; for ($i=0; $i<$routine_details['item_num_params']; $i++) { if ($routine_details['item_type'] == 'PROCEDURE' && $routine_details['item_param_dir'][$i] == 'OUT' ) { continue; } $execute_action = 'execute_dialog'; break; } $retval .= ' ' . $titles['Execute'] . "\n"; } $retval .= " \n"; $retval .= " \n"; $retval .= ' ' . $titles['Export'] . "\n"; $retval .= " \n"; $retval .= " \n"; if (PMA_Util::currentUserHasPrivilege('ALTER ROUTINE', $db)) { $retval .= ' ' . $titles['Drop'] . "\n"; } else { $retval .= " {$titles['NoDrop']}\n"; } $retval .= " \n"; $retval .= " \n"; $retval .= " {$routine['ROUTINE_TYPE']}\n"; $retval .= " \n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($routine['DTD_IDENTIFIER']) . "\n"; $retval .= " \n"; $retval .= " \n"; return $retval; } // end PMA_RTN_getRowForList() /** * Creates the contents for a row in the list of triggers * * @param array $trigger An array of routine data * @param string $rowclass Empty or one of ['even'|'odd'] * * @return string HTML code of a cell for the list of triggers */ function PMA_TRI_getRowForList($trigger, $rowclass = '') { global $ajax_class, $url_query, $db, $table, $titles; $retval = " \n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($trigger['drop']) . "\n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($trigger['name']) . "\n"; $retval .= " \n"; $retval .= " \n"; if (empty($table)) { $retval .= " \n"; $retval .= " " . $trigger['table'] . "\n"; $retval .= " \n"; } $retval .= " \n"; if (PMA_Util::currentUserHasPrivilege('TRIGGER', $db, $table)) { $retval .= ' ' . $titles['Edit'] . "\n"; } else { $retval .= " {$titles['NoEdit']}\n"; } $retval .= " \n"; $retval .= " \n"; $retval .= ' ' . $titles['Export'] . "\n"; $retval .= " \n"; $retval .= " \n"; if (PMA_Util::currentUserHasPrivilege('TRIGGER', $db)) { $retval .= ' ' . $titles['Drop'] . "\n"; } else { $retval .= " {$titles['NoDrop']}\n"; } $retval .= " \n"; $retval .= " \n"; $retval .= " {$trigger['action_timing']}\n"; $retval .= " \n"; $retval .= " \n"; $retval .= " {$trigger['event_manipulation']}\n"; $retval .= " \n"; $retval .= " \n"; return $retval; } // end PMA_TRI_getRowForList() /** * Creates the contents for a row in the list of events * * @param array $event An array of routine data * @param string $rowclass Empty or one of ['even'|'odd'] * * @return string HTML code of a cell for the list of events */ function PMA_EVN_getRowForList($event, $rowclass = '') { global $ajax_class, $url_query, $db, $titles; $sql_drop = sprintf( 'DROP EVENT IF EXISTS %s', PMA_Util::backquote($event['EVENT_NAME']) ); $retval = " \n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($sql_drop) . "\n"; $retval .= " \n"; $retval .= " " . htmlspecialchars($event['EVENT_NAME']) . "\n"; $retval .= " \n"; $retval .= " \n"; $retval .= " \n"; $retval .= " {$event['STATUS']}\n"; $retval .= " \n"; $retval .= " \n"; if (PMA_Util::currentUserHasPrivilege('EVENT', $db)) { $retval .= ' ' . $titles['Edit'] . "\n"; } else { $retval .= " {$titles['NoEdit']}\n"; } $retval .= " \n"; $retval .= " \n"; $retval .= ' ' . $titles['Export'] . "\n"; $retval .= " \n"; $retval .= " \n"; if (PMA_Util::currentUserHasPrivilege('EVENT', $db)) { $retval .= ' ' . $titles['Drop'] . "\n"; } else { $retval .= " {$titles['NoDrop']}\n"; } $retval .= " \n"; $retval .= " \n"; $retval .= " {$event['EVENT_TYPE']}\n"; $retval .= " \n"; $retval .= " \n"; return $retval; } // end PMA_EVN_getRowForList() ?>