Skip to content

Commit

Permalink
RSS Feed reder deleted cuz it raise an exception for every RSS file, …
Browse files Browse the repository at this point in the history
…remove $info and pass variables directly as global variables, id variable changed to content, all views are reviewed and tested.
  • Loading branch information
emad-elsaid committed Mar 7, 2011
1 parent cc5f72b commit 9fd3bd8
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 129 deletions.
34 changes: 13 additions & 21 deletions application/models/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,12 @@ public function cells(){
if( $this->path =='' )
return 1;

return intval($this->load->view(
'content/'.$this->path,
array(
'id'=> $this->id,
'ci'=> $this->ci,
'info'=>$this->get_info(),
'mode'=>'layout'
),
TRUE
));
$info = &$this->get_info();
$info->content = &$this;
$info->ci = &$this->ci;
$info->mode = 'layout';

return intval($this->load->view('content/'.$this->path, $info, TRUE));
}

/**
Expand Down Expand Up @@ -193,17 +189,13 @@ public function render(){
* cells text if not just pass the first cell value
**/
if( !empty($this->path) and !is_null($this->path) ){
$text = $this->load->view(
'content/'.$this->path,
array(
'id'=>$this->id,
'ci'=> $this->ci,
'cell'=> $layout_content,
'info'=>$this->get_info(),
'mode'=> 'view'
),
TRUE
);

$info = &$this->get_info();
$info->content = &$this;
$info->ci = &$this->ci;
$info->cell = &$layout_content;
$info->mode = 'view';
$text = $this->load->view( 'content/'.$this->path, $info, TRUE );
}else{
/**
* if the layout not exists then but the 1st cell as
Expand Down
28 changes: 13 additions & 15 deletions application/views/content/Basic/Document settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class:
$ci =& get_instance();
if( $ci->system->mode=='edit' )
{
$c = new Content();
$c->get_by_id( $id );

if( $ci->ion_auth->is_admin() )
{
Expand All @@ -61,21 +59,21 @@ class:
<?php
$local = base_url();

if( $info->Resetstyle ) theme_add( 'assets/style/reset.css' );
if( $info->Textstyle ) theme_add( 'assets/style/text.css' );
if( !empty($info->favIcon) ) theme_add('<link rel="icon" href="'.base_url().$info->favIcon.'">');
theme_add(explode("\n",$info->javascript_files));
theme_add(explode("\n",$info->css_files));
if( $Resetstyle ) theme_add( 'assets/style/reset.css' );
if( $Textstyle ) theme_add( 'assets/style/text.css' );
if( !empty($favIcon) ) theme_add('<link rel="icon" href="'.base_url().$favIcon.'">');
theme_add(explode("\n",$javascript_files));
theme_add(explode("\n",$css_files));

$style = '';
if( $info->background_image != '' )
if( $background_image != '' )
{
$style .= "background-image: url({$local}{$info->background_image});";
$style .= "background-position: {$info->horizontal_position} {$info->vertical_position};";
$style .= "background-repeat: {$info->repeat};";
$style .= "background-attachment: {$info->attachment};";
$style .= "background-image: url({$local}{$background_image});";
$style .= "background-position: {$horizontal_position} {$vertical_position};";
$style .= "background-repeat: {$repeat};";
$style .= "background-attachment: {$attachment};";
}
$style .= $info->style;
$style .= $style;
if( $style!='' )
{
theme_add("
Expand All @@ -86,14 +84,14 @@ class:
</style>
");
if(!empty($info->class))
if(!empty($class))
{
theme_add('jquery/jquery.js');
theme_add(
<<<EOT
<script language="javascript" >
$(function(){
$(document).addClass('{$info->class}');
$(document).addClass('{$class}');
});
</script>
EOT
Expand Down
34 changes: 17 additions & 17 deletions application/views/content/Basic/Flash movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
height:
type:number
bg:
type:color
type:text
label:background color
quality:
type:dropdown
Expand All @@ -32,26 +32,26 @@
0
<?php elseif( $mode=='view' ): ?>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
width="<?=$info->width?>"
height="<?=$info->height?>"
align="<?=$info->align?>" >
<param name=movie value="<?=base_url().$info->flash?>">
<param name=quality value=<?=$info->quality?>>
<?php if($info->transparent ): ?>
width="<?=$width?>"
height="<?=$height?>"
align="<?=$align?>" >
<param name=movie value="<?=base_url().$flash?>">
<param name=quality value=<?=$quality?>>
<?php if($transparent ): ?>
<param name=wmode value=transparent>
<?php endif; ?>
<param name=bgcolor value=<?=$info->bg?>>
<param name="loop" value="<?= ($info->loop)?'true':'false' ?>">
<param name=bgcolor value=<?=$bg?>>
<param name="loop" value="<?= ($loop)?'true':'false' ?>">
<EMBED
src="<?=base_url().$info->flash?>"
quality="<?=$info->quality?>"
bgcolor="<?=$info->bg?>"
width="<?=$info->width?>"
height="<?=$info->height?>"
loop="<?= ($info->loop)?'true':'false' ?>"
src="<?=base_url().$flash?>"
quality="<?=$quality?>"
bgcolor="<?=$bg?>"
width="<?=$width?>"
height="<?=$height?>"
loop="<?= ($loop)?'true':'false' ?>"
type="application/x-shockwave-flash"
align="<?=$info->align?>"
<?php if($info->transparent){?>wmode="transparent" <?php } ?>
align="<?=$align?>"
<?php if($transparent){?>wmode="transparent" <?php } ?>

pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
>
Expand Down
6 changes: 3 additions & 3 deletions application/views/content/Basic/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
type:textarea
<?php elseif( $mode=='view' ): ?>
<?php
if( $info->add==TRUE )
theme_add($info->Text);
if( $add==TRUE )
theme_add($Text);
else
echo $info->Text;
echo $Text;
?>
<?php endif; ?>
2 changes: 1 addition & 1 deletion application/views/content/Basic/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
style:
type:textarea
<?php elseif( $mode=='view' ): ?>
<img src="<?= base_url().$info->image; ?>" style="<?= $info->style; ?>" >
<img src="<?= base_url().$image; ?>" style="<?= $style; ?>" >
<?php endif; ?>
4 changes: 2 additions & 2 deletions application/views/content/Basic/Information or Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<?php
$ci->load->library( "gui" );
$f = $info->type;
echo $ci->gui->$f( $info->text );
$f = $type;
echo $ci->gui->$f( $text );
?>
<?php endif; ?>
9 changes: 3 additions & 6 deletions application/views/content/Basic/JS or CSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@

<?php elseif( $mode=='view' ): ?>
<?php
theme_add( explode( "\n", $info->resourceFiles) );
theme_add( explode( "\n", $resourceFiles) );

if( $ci->system->mode=='edit' )
{
$c = new Content();
$c->get_by_id( $id );

{
if( $ci->ion_auth->is_admin() )
{
$ci->load->library( 'gui' );
echo $ci->gui->info( 'Resource '.nl2br($info->resourceFiles) );
echo $ci->gui->info( 'Resource '.nl2br($resourceFiles) );
}
}
?>
Expand Down
30 changes: 0 additions & 30 deletions application/views/content/Basic/RSS Feed.php

This file was deleted.

4 changes: 1 addition & 3 deletions application/views/content/Basic/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@

<?php elseif( $mode=='view' ): ?>
<?php
$c = new Content();
$c->get_by_id( $id );

$u = ( empty($info->externel) )? site_url($info->section) : $info->externel;
$u = ( empty($externel) )? site_url($section) : $externel;

if( ($ci->system->mode=='edit') and $ci->ion_auth->is_admin() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?php elseif( $mode=='view' ): ?>
<?php
$instance = new Content();
$instance->get_by_id( $info->id );
$instance->get_by_id( $id );
if( $instance->exists() )
echo $instance->render();
else
Expand Down
2 changes: 1 addition & 1 deletion application/views/content/Basic/Richtext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Text:
type:editor
<?php elseif( $mode=='view' ): ?>
<?= $info->Text ?>
<?= $Text ?>
<?php endif; ?>
10 changes: 5 additions & 5 deletions application/views/content/Basic/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
style:
type:textarea
<?php elseif( $mode=='layout' ): ?>
<?= $info->columns*$info->rows ?>
<?= $columns*$rows ?>
<?php elseif( $mode=='view' ): ?>
<table style="<?= $info->style ?>">
<?php for( $i=0; $i<$info->rows; $i++ ){ ?>
<table style="<?= $style ?>">
<?php for( $i=0; $i<$rows; $i++ ){ ?>
<tr>
<?php for( $j=0; $j<$info->columns; $j++ ){ ?>
<?php for( $j=0; $j<$columns; $j++ ){ ?>
<td>
<?= $cell[$i*$info->columns+$j] ?>
<?= $cell[$i*$columns+$j] ?>
</td>
<?php } ?>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion application/views/content/Basic/Text with variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@month" => date('n'),
"@year" => date('Y')
);
$formatted = $info->text;
$formatted = $text;
foreach ($replaces as $key=>$value)
{
$formatted = str_replace( $key, $value, $formatted );
Expand Down
8 changes: 4 additions & 4 deletions application/views/content/Basic/sections line.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
<?php
$sections = new Section();
$sections->order_by( 'sort', 'asc' );
$sections->get_by_parent_section( $info->parent );
$sections->get_by_parent_section( $parent );

function remove_denied($sec )
{
return $sec->can_view();
}

$secs = $sections;
$secs = $sections->all;
$secs = array_filter( $secs, 'remove_denied' );
$hyperLinks = array();

foreach( $secs as $item )
{
$local = site_url( $item->id );
array_push( $hyperLinks, "<a href=\"{$local}\" style=\"{$info->style}\" >{$item->name}</a>\n" );
array_push( $hyperLinks, "<a href=\"{$local}\" style=\"{$style}\" >{$item->name}</a>\n" );
}

echo implode( $info->separator, $hyperLinks );
echo implode( $separator, $hyperLinks );
?>
<?php endif; ?>
6 changes: 3 additions & 3 deletions application/views/content/Dojo/Hbox.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php if( $mode=='config' ): ?>
cells:
cellsno:
type:number
default:1
style:
type:textarea
<?php elseif( $mode=='layout' ): ?>
<?= $info->cells ?>
<?= $cellsno ?>
<?php elseif( $mode=='view' ): ?>

<?php
$ci =& get_instance();
$ci->load->library( 'gui' );
echo $ci->gui->hbox( $cell, '', $info->style );
echo $ci->gui->hbox( $cell, '', $style );
?>
<?php endif; ?>
10 changes: 5 additions & 5 deletions application/views/content/Dojo/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
type:textbox
default:100%
<?php elseif( $mode=='layout' ): ?>
<?= count( explode( "\n", $info->titles ) ); ?>
<?= count( explode( "\n", $titles ) ); ?>
<?php elseif( $mode=='view' ): ?>


<?php
$ci->load->library( 'gui' );

//assign every key to it's value
$info->titles = explode( "\n", $info->titles );
echo $ci->gui->tab(array_combine( $info->titles, $cell),array(),
array('width'=>$info->width,'height'=>$info->height)
$titles = explode( "\n", $titles );
echo $ci->gui->tab(array_combine( $titles, $cell),array(),
array('width'=>$width,'height'=>$height)
);
?>
<?php endif; ?>
6 changes: 3 additions & 3 deletions application/views/content/Dojo/Vbox.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php if( $mode=='config' ): ?>
cells:
cellsno:
type:number
default:1
style:
type:textarea
<?php elseif( $mode=='layout' ): ?>
<?= $info->cells ?>
<?= $cellsno ?>
<?php elseif( $mode=='view' ): ?>

<?php
$ci =& get_instance();
$ci->load->library( 'gui' );
echo $ci->gui->vbox( $cell, '', $info->style );
echo $ci->gui->vbox( $cell, '', $style );
?>
<?php endif; ?>
Loading

0 comments on commit 9fd3bd8

Please sign in to comment.