Jump to content
php.lv forumi

scripta kluuda


djmartins

Recommended Posts

Hmm kaut kaada kluda laikam 72 rindaa tikai nerubiiju kas iisti!NU karoc Ja kads var tad ludzu parskata visu scriptu un ieluur kas tur varetu but neriktigi.

 

 

<?php

/** \file Text

\brief Text

- Author : Henk Jurriens

- Date : 12/09/2003

 

 

*/

 

/** Class for Text

 

*/

 

class module_text extends module{

 

function GetType(){

return "text";

}

 

 

function ShowModule( $page, $row ){

 

/** Admin text */

$action = $this->AdminMenu( "text" );

$result = $this->CheckSubmit( array( "text" ) );

 

//print_r( $row );

$result = query( "SELECT * from text where mod_text = {$row['module_textID']} " );

while ($row = mysql_fetch_array($result) ){

print "<h2>{$row['title']}</h2>";

 

if ( $row["image"] <> "" ){

 

print "<img src='{$row["image"]}' alt='{$row["image"]}' style='float : {$row['image_align']}' />";

 

}

 

print html_entity_decode($row["text"]);

/** Admin edit and delete photo */

 

$action = $this->AdminEditDelete( "text", $row['textID']);

 

}

 

}

 

}

 

/** Class for Search_text

 

*/

 

class search_text extends search{

 

 

function search_text(){

/** initializes $module and $table

 

*/

$this->module = "module_text";

$this->table = "module_text";

}

 

function DisplayResult( $row ){

$page = $_GET["page"];

return "<a href='$PHP_SELF?page=$page&module=text&id=''><h4>{$row['title']}</h4></a>{$row['description']}<p />";

}

 

}

 

 

class module_text_admin extends admin_module{

 

function General(){

$this->SetTables( array( "text" ) );

 

// Get information about the module for this page

$row = $this->GetModuleData();

 

$table = New AdminTable;

$table->Header( "module_text", "" );

$table->InputRow( 'name', 'name', "{$row[name]}" );

$table->InputRow( 'description', 'description', "{$row[description]}" );

$table->Footer();

 

}

 

function Content(){

parent::Content();

 

print "<p><b>Text</b></p>";

 

$this->ShowAddButton( "text" );

 

$table = New AdminTable;

$table->Header( "text", array( "title", "created", "valid from", "valid till" ) );

$row = $this->GetModuleData();

$moduleid = $row[0];

 

$result = query( "SELECT * FROM text WHERE mod_text = $moduleid" );

while ( $row = mysql_fetch_array( $result ) ){

$table->DisplayRow( $row['textID'], array( $row['title'], $row['created'], $row['valid_from'], $row['valid_till'] ) );

}

$table->Footer();

 

 

 

}

 

function Edit(){

global $ses_language;

 

$id = $_GET['id'];

$cmdOK = $_GET['cmdOK'];

$table = $_GET['table'];

if ( isset( $cmdOK )){

$id = $_GET['id'];

$title = $_GET['title'];

$text = $_GET['text'];

$created = $_GET['created'];

$valid_from = $_GET['valid_from'];

$valid_till = $_GET['valid_till'];

 

switch ( $table ){

case "text" :

 

$q = "UPDATE `text` SET `title` = '$title', `text` = '$text', `created` = '$created', `valid_from` = '$valid_from', `valid_till` = '$valid_till' WHERE `textID` = '$id' AND `language` = '$ses_language' LIMIT 1 ";

$result = query( $q );

$this->GoBack();

break;

}

 

}

 

 

switch ( $table ){

case "text" :

print "<h2>Edit</h2>";

$row = $this->GetRowByIDLanguage( "text", $id );

$table = New AdminTable;

$table->Header( "", "" );

$table->HiddenFields( );

 

$table->InputRow( 'title', 'title', "{$row['title']}" );

$table->InputRowTextArea( 'text', 'text', "{$row['text']}", 60, 10 );

$table->InputRow( 'created', 'created', "{$row['created']}" );

$table->InputRow( 'valid from', 'valid_from', "{$row['valid_from']}" );

$table->InputRow( 'valid till', 'valid_till', "{$row['valid_till']}" );

$table->OKCancel();

$table->Footer();

break;

 

 

}

 

 

}

 

function Add(){

global $ses_language;

 

$id = $_GET['id'];

$cmdOK = $_GET['cmdOK'];

$table = $_GET['table'];

if ( isset( $cmdOK )){

 

 

$title = $_GET['title'];

$text = $_GET['text'];

$created = $_GET['created'];

$valid_from = $_GET['valid_from'];

$valid_till = $_GET['valid_till'];

 

switch ( $table ){

case "text" :

//## index?

$newID = $this->GetNewTableID( "text" );

$row = $this->GetModuleData();

$moduleid = $row[0];

 

$q = "INSERT INTO `text` ( `textID` , `language` , `mod_text`, `title`, `text` , `created` , `valid_from` , `valid_till` ) ";

$q .= "VALUES ( '$newID', '$ses_language', $moduleid, '$title', '$text', '$created', '$valid_from', '$valid_till' )";

$result = query( $q );

$this->GoBack();

break;

}

 

}

 

switch ( $table ){

case "text" :

print "<h2>Add</h2>";

$table = New AdminTable;

$table->Header( "", "" );

$table->HiddenFields( );

 

$table->InputRow( 'title', 'title', "" );

$table->InputRowTextArea( 'text', 'text', "", 60, 10 );

$table->InputRow( 'created', 'created', "" );

$table->InputRow( 'valid from', 'valid_from', "" );

$table->InputRow( 'valid till', 'valid_till', "" );

$table->OKCancel();

$table->Footer();

$table->OKCancel();

$table->Footer();

break;

}

 

}

 

 

function Delete(){

$table = $_GET['table'];

switch ( $table ) {

case "text" :

$this->DeleteRow( "text" );

break;

}

 

}

 

 

}

 

 

?>

Link to comment
Share on other sites

×
×
  • Create New...