* Each web page using the JavaScript pagination engine has its own function in this class.
* For simple cells content, you don't need to call this class : you can directly generate the text from the ajax.php file
*/
class html
{
/**
* @brief Generate text / html for a MyHostings page cell
* @param cell_index : Zero-based cell index
* @param hosting_datas : Datas corresponding to the current hosting entry
* @return string with html code
*
* The first and the fifth column for the "MyHosting" page needs specials texts that have to be generated regarding to the corresponding hosting status.
* These links are generated with this method ($cell_index = 0 for the first, and $cell_index = 4 for the fifth).
* The function will check if the current hosting is active. If so, the first column will contain a link to the hosting details. If the hosting is suspended, the fifth column will have a link to the support ticket creation page.
*/
static public function makeHtmlForMyHostings( $cell_index, $hosting_datas )
{
$result=null;
switch( $cell_index )
{
case 0: // Hosting name
$cell_text = $hosting_datas->full_name;
if ( $hosting_datas->hosting_active == 'true' ) {
$result = '';
$result .= $cell_text;
$result .= '';
} else {
$result = $cell_text;
}
break;
case 4: // Hosting status
if ( $hosting_datas->hosting_active == 'true' ) {
$result = $hosting_datas->statusText;
} else {
$result = $hosting_datas->statusText . ' ';
$result .= '
';
}
break;
}
return $result;
} // End of makeHtmlForMyHostings
/**
* @brief Generate text / html for a Support page cell
* @param cell_index : Zero-based cell index
* @param ticket_datas : Datas corresponding to the current ticket entry
* @return string with html code
*
* The first column for the "Support" page needs a link to get the ticket's detail page.
* This link can be generated with this method.
*/
static public function makeHtmlForSupport( $cell_index, $ticket_datas )
{
$result=null;
switch( $cell_index )
{
case 0: // Open date
$result = '';
$result .= $ticket_datas->label_text . '';
break;
}
return $result;
}
/**
* @brief Generate text / html for a ticket details page cell
* @param cell_index : Zero-based cell index
* @param reply_datas : Datas corresponding to the current reply entry
* @return string with html code
*
* The first column for the "Ticket Details" page needs html code showing who made the current reply, and the date of this reply.
*/
static public function makeHtmlForTicketDetails( $cell_index, $reply_datas )
{
$result=null;
switch( $cell_index )
{
case 0: // Author / Date
$result = $reply_datas->msg_author . '
' . $reply_datas->msg_date;
break;
}
return $result;
}
/**
* @brief Generate text / html for a Admin/Support page cell
* @param cell_index : Zero-based cell index
* @param ticket_datas : Datas corresponding to the current ticket entry
* @return string with html code
*/
static public function makeHtmlForAdminSupport( $cell_index, $ticket_datas )
{
$result=null;
switch( $cell_index )
{
case 0: // Open date
$result = '';
$result .= $ticket_datas->open_date . '';
break;
}
return $result;
}
/**
* @brief Generate text / html for a Cron page cell
* @param cell_index : Zero-based cell index
* @param cron_datas : Datas corresponding to the current cron entry
* @return string with html code
*
*/
static public function makeHtmlForCron( $cell_index, $cron_datas )
{
$result = null;
switch ( $cell_index )
{
case 0: // Buttons
// Links for "Start/Stop"
$on_success="function(response){getPage('tbl_cron', ".$cron_datas->current_page.", ".$cron_datas->max_pages.", 1);}";
$on_failure="function(){ alert(critical_error); }";
if ( $cron_datas->is_active == 'true' ) {
$action = 'cronStopTask';
$image = 'control_stop';
} else {
$action = 'cronStartTask';
$image = 'control_play';
}
$start_stop="doSingleRequest('$action', $cron_datas->id, $on_success, $on_failure, 1);";
$result = '
';
// Links for "Delete"
$delete="doSingleRequest('cronDeleteTask', $cron_datas->id, $on_success, $on_failure, 1);";
$result .= '
';
break;
case 1: // Address
$display_address = str_replace('http://', '', htmlentities($cron_datas));
$display_address = str_replace('https://', '', $cron_datas);
if ( strlen($display_address) >= 60 ) $display_address = substr($display_address, 0, 60) . "..." ;
$result .= ''.$display_address.'';
break;
}
return $result;
}
}
?>