Пример #1
0
 public static function factory($id = null)
 {
     $instance = new ContentType();
     if (!empty($id)) {
         $instance->where('id', $id)->get();
     }
     return $instance;
 }
Пример #2
0
 public function index($type = '')
 {
     foreach (ContentType::all() as $type) {
         $content = new ContentType($type->name);
         $content->createTable();
         $content->updateColumns();
     }
     // $content = new ContentType('missionary');
     // $content->createRecord(array('name' => 'John Lennon', 'slug' => 'john-lennon'));
     // $content = new ContentType('country');
     // $content->createRecord(array('name' => 'Germany', 'code' => 'de'));
     $this->content = View::auto();
 }
Пример #3
0
 protected function define_fields()
 {
     $this->name = new TextField(pjango_gettext('Name'), 35, 255, array('validate_required'));
     $this->codename = new TextField(pjango_gettext('Code Name'), 35, 255, array('validate_required'));
     $contentTypeChoices = \ContentType::findAllAsChoice();
     $this->content_type_id = new DropDownField('Content Type', $contentTypeChoices);
 }
Пример #4
0
 public static function get_for_model($model, $app_label = false, $name = false)
 {
     $q = Doctrine_Query::create()->from('ContentType o')->where('o.model = ?', array($model));
     if ($app_label) {
         $q->addWhere('o.app_label = ?', array($app_label));
     }
     $contentType = $q->fetchOne();
     if (!$contentType) {
         $contentType = new ContentType();
         $contentType->app_label = $app_label;
         $contentType->model = $model;
         $contentType->name = $app_label . ' ' . $model;
         $contentType->save();
     }
     return $contentType;
 }
 /**
  * Returns an object to be used by `json_encode` to serialize objects of this class.
  *
  * @return object
  *
  * @see http://php.net/manual/en/jsonserializable.jsonserialize.php JsonSerializable::jsonSerialize
  */
 public function jsonSerialize()
 {
     $obj = new \stdClass();
     if ($this->id !== null) {
         $obj->id = $this->id;
     }
     if ($this->type !== null) {
         $obj->type = $this->type;
     }
     if ($this->space !== null) {
         $obj->space = (object) ['sys' => (object) ['type' => 'Link', 'linkType' => 'Space', 'id' => $this->space->getId()]];
     }
     if ($this->contentType !== null) {
         $obj->contentType = (object) ['sys' => (object) ['type' => 'Link', 'linkType' => 'ContentType', 'id' => $this->contentType->getId()]];
     }
     if ($this->revision !== null) {
         $obj->revision = $this->revision;
     }
     if ($this->createdAt !== null) {
         $obj->createdAt = $this->formatDateForJson($this->createdAt);
     }
     if ($this->updatedAt !== null) {
         $obj->updatedAt = $this->formatDateForJson($this->updatedAt);
     }
     if ($this->deletedAt !== null) {
         $obj->deletedAt = $this->formatDateForJson($this->deletedAt);
     }
     return $obj;
 }
 function &create_default_pipeline($encoding, $filename)
 {
     $pipeline =& new Pipeline();
     if (isset($GLOBALS['g_config'])) {
         $pipeline->configure($GLOBALS['g_config']);
     } else {
         $pipeline->configure(array());
     }
     //     if (extension_loaded('curl')) {
     //       require_once(HTML2PS_DIR.'fetcher.url.curl.class.php');
     //       $pipeline->fetchers[] = new FetcherUrlCurl();
     //     } else {
     require_once HTML2PS_DIR . 'fetcher.url.class.php';
     $pipeline->fetchers[] = new FetcherURL();
     //     };
     $pipeline->data_filters[] = new DataFilterDoctype();
     $pipeline->data_filters[] = new DataFilterUTF8($encoding);
     $pipeline->data_filters[] = new DataFilterHTML2XHTML();
     $pipeline->parser = new ParserXHTML();
     $pipeline->pre_tree_filters = array();
     $pipeline->layout_engine = new LayoutEngineDefault();
     $pipeline->post_tree_filters = array();
     $pipeline->output_driver = new OutputDriverFPDF();
     $pipeline->output_filters = array();
     $pipeline->destination = new DestinationDownload($filename, ContentType::pdf());
     return $pipeline;
 }
Пример #7
0
 public function actionAdd()
 {
     global $arr_response;
     $model = new Subject();
     $model->scenario = 'add';
     $_REQUEST['content_type_id'] = ContentType::model()->find('name=:name', array(':name' => $_REQUEST['content_type']))->id;
     $_REQUEST['country_id'] = Country::model()->find('code=:code', array(':code' => $_REQUEST['country_code']))->id;
     $_REQUEST['priority_id'] = Priority::model()->find('name=:name', array(':name' => $_REQUEST['priority']))->id;
     if ($_REQUEST['time']) {
         if (date("l", $_REQUEST['time'])) {
             //if its a valid timestamp
             $_REQUEST['user_position_ymd'] = date("Y", $_REQUEST['time']) . "/" . date("m", $_REQUEST['time']) . "/" . date("d", $_REQUEST['time']);
             $_REQUEST['user_position_hour'] = date("H", $_REQUEST['time']);
             $_REQUEST['user_position_minute'] = date("i", $_REQUEST['time']);
         }
     } else {
         $_REQUEST['user_position_anydatetime'] = 1;
     }
     $model->attributes = $_REQUEST;
     //NOTICE that we are creating a new record, so model its not loaded, ($model->content_type its juest the received $_REQUEST parameter)
     //print_r($model);
     //$model->content_type_id = $content_type->id;
     if ($model->save()) {
         $arr_response['response_message'] = Yii::t('subject', 'Subject successfully saved.');
     } else {
         $arr_response['response_code'] = 409;
         $arr_response['response_message'] = Yii::t('subject', 'Subject could not be saved.');
         $arr_response['response_details'] = $model->getErrors();
     }
 }
Пример #8
0
 public function testExtractsAll()
 {
     $r = self::request('/adm/123erwe34_175x75_bgFFF_bw.jpg');
     $this->assertEquals('adm', $r->group);
     $this->assertEquals('123erwe34', $r->id);
     $this->assertEquals('175x75_bgFFF_bw', $r->commandString);
     $this->assertEquals(ContentType::jpeg(), $r->contentType);
 }
Пример #9
0
 public static function make_token($contentType, $objectId)
 {
     $ctype = ContentType::get_for_model($contentType);
     $_instance = new self();
     $_instance->token = md5(uniqid(rand(), true));
     $_instance->status = self::STATUS_NEW;
     $_instance->expires = date('Y-m-d H:i:s', time() + 7 * 24 * 60 * 60);
     $_instance->object_id = $objectId;
     $_instance->ContentType = $ctype;
     $_instance->save();
     return $_instance;
 }
Пример #10
0
 public function new_content($cname, $pid)
 {
     $page = Page::factory((int) $pid);
     $ctype = ContentType::factory()->where('classname', "Gallery")->limit(1)->get();
     $content = Content::factory();
     $content->div = $cname;
     $content->editor_id = $this->user->id;
     $content->page_id = $page->id;
     $content->contenttype_id = $ctype->id;
     $content->save();
     $redir = site_url('administration/images/gallery_add_new/' . $content->id . '/' . $cname . '/' . $pid) . '?iu-popup';
     redirect($redir);
 }
 function create_default_pipeline($encoding, $filename)
 {
     $pipeline = new Pipeline();
     $pipeline->fetchers[] = new FetcherURL();
     $pipeline->data_filters[] = new DataFilterUTF8($encoding);
     $pipeline->data_filters[] = new DataFilterHTML2XHTML();
     $pipeline->parser = new ParserXHTML();
     $pipeline->pre_tree_filters = array();
     $pipeline->layout_engine = new LayoutEngineDefault();
     $pipeline->post_tree_filters = array();
     $pipeline->output_driver = new OutputDriverFPDF();
     $pipeline->output_filters = array();
     $pipeline->destination = new DestinationDownload($filename, ContentType::pdf());
     return $pipeline;
 }
Пример #12
0
 public function init()
 {
     $baseUrl = Yii::app()->baseUrl;
     $slash = empty($baseUrl) ? '' : '/';
     $themeUrl = $baseUrl . $slash . Yii::app()->theme->baseUrl;
     $this->scriptLocations[Yii::app()->theme->basePath] = $themeUrl;
     if (Yii::app()->request->pathInfo != 'content-type/status') {
         $data = ContentType::findAll();
         foreach ($data as $ct) {
             $ct->checkForErrors();
             if ($ct->hasSchemaErrors()) {
                 Yii::app()->user->setFlash('danger', '<strong>Warning!</strong> Some content types database tables are not up to date. ' . CHtml::link('Please update them here.', array('contentType/status')));
             }
         }
     }
 }
Пример #13
0
 public function ajax_save()
 {
     $id = (int) $this->input->post('id');
     $pid = (int) $this->input->post('page_id');
     $div = $this->input->post('div');
     $title = $this->input->post('title');
     $text = $this->input->post('text');
     $img = $this->input->post('image');
     //file_put_contents('post', json_encode($_POST));die;
     $page = Page::factory($pid);
     $content = Content::factory()->where('div', $div)->where_related_page('id', $pid)->limit(1)->get();
     if (!$content->exists()) {
         $content = new Content();
         $content->div = $div;
         $ctype = ContentType::factory()->where('classname', 'Repeatable')->limit(1)->get();
         $content->editor_id = $this->user->id;
         $content->save(array($page, $ctype));
     } else {
         $content->editor_id = $this->user->id;
         $content->save();
     }
     if (empty($id)) {
         $item = new RepeatableItem();
         $item->timestamp = time();
     } else {
         $item = RepeatableItem::factory($id);
     }
     $item->title = $title;
     $item->text = $text;
     $item->image = trim($img, '/');
     if (empty($id)) {
         $item->save(array($content, $this->user));
     } else {
         $item->save();
     }
     if (empty($id)) {
         $msg = __("New item published: \"%s\"", $title);
     } else {
         $msg = __("Changes saved in \"%s\"", $title);
     }
     echo json_encode(array('status' => 'OK', 'message' => $msg, 'id' => $item->id));
 }
Пример #14
0
 public function actionUpdateAll()
 {
     //Clear out current flash messages
     Yii::app()->user->getFlashes();
     $data = ContentType::findAll();
     foreach ($data as $ct) {
         $ct->checkForErrors();
         if ($ct->hasSchemaErrors()) {
             if (!$ct->tableExists()) {
                 $ct->createTable();
                 Yii::app()->user->setFlash('success', "Table <strong>{$ct->tableName}</strong> created");
             }
             if ($ct->tableExists() && $ct->fieldsExist() !== true) {
                 $ct->createFields();
                 Yii::app()->user->setFlash('success', "Created field(s) for <strong>{$ct->tableName}</strong>");
             }
         }
     }
     $this->redirect(array('contentType/status'));
 }
 public function up()
 {
     //First make sure all tables are created
     $data = ContentType::findAll();
     foreach ($data as $ct) {
         $ct->checkForErrors();
         if ($ct->hasSchemaErrors()) {
             if (!$ct->tableExists()) {
                 $ct->createTable();
             }
             if ($ct->tableExists() && $ct->fieldsExist() !== true) {
                 $ct->createFields();
             }
         }
     }
     $this->insert('{{content}}', array('id' => '1', 'title' => 'Welcome to My Website', 'type' => 'homepage', 'published' => '1', 'created_by' => '1', 'updated_by' => '1', 'created' => new CDbExpression('NOW()'), 'updated' => new CDbExpression('NOW()')));
     $this->insert('{{content_homepage}}', array('content_id' => '1', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut euismod vestibulum turpis, at consequat mi tincidunt non. Nulla consectetur ligula congue purus faucibus venenatis. Integer ac facilisis nunc. Nullam sodales lacus erat, dictum sollicitudin nunc tincidunt nec. Suspendisse potenti. Nam nec tincidunt metus. Nunc at odio iaculis, fringilla lectus ut, semper dui. Nullam pulvinar varius elementum. Cras dignissim risus a leo mattis, a lacinia ligula luctus. Fusce vitae placerat tellus, sed laoreet augue. Donec pulvinar dui sed enim sollicitudin consequat. Donec ut scelerisque ligula. Donec nec semper purus. Quisque ac consequat mauris. Suspendisse vulputate neque feugiat auctor convallis. Aenean ut erat euismod, volutpat mi non, varius odio.', 'content_2' => 'Nunc eu laoreet nibh, vitae hendrerit urna. Sed egestas sapien vitae sem suscipit, et blandit justo sagittis. Integer ut posuere sapien, non dictum est. Morbi lobortis ut eros convallis dictum. Sed leo odio, cursus sit amet tincidunt at, ultrices a purus. Integer vestibulum luctus urna sed suscipit. Integer non massa fermentum, egestas lorem in, congue urna. Vestibulum ligula diam, egestas sed nulla sed, consectetur laoreet massa. In leo ligula, elementum ac mattis quis, congue et neque. Donec nulla arcu, consectetur vitae pharetra vitae, posuere eget tellus. In leo purus, lacinia non libero sed, mattis sollicitudin ante. ', 'meta_keywords' => 'some,keywords,here', 'meta_description' => 'A meta description can go here'));
     $this->insert('{{content}}', array('id' => '2', 'title' => 'News', 'path' => '/news', 'type' => 'news_list', 'published' => '1', 'created_by' => '1', 'updated_by' => '1', 'created' => new CDbExpression('NOW()'), 'updated' => new CDbExpression('NOW()')));
     $this->insert('{{content_news_list}}', array('content_id' => '2', 'content' => '', 'meta_keywords' => 'some,keywords,here', 'meta_description' => 'A meta description can go here'));
     $this->insert('{{menu_items}}', array('title' => 'News', 'menu_id' => 'main_menu', 'content_id' => '2', 'created' => new CDbExpression('NOW()'), 'updated' => new CDbExpression('NOW()')));
     $this->insert('{{menu_items}}', array('title' => 'Contact', 'menu_id' => 'main_menu', 'external_path' => '/site/contact', 'created' => new CDbExpression('NOW()'), 'updated' => new CDbExpression('NOW()')));
     //Not sure why this doen't work?
     Yii::log('SnapCMS installed.', 'info', 'installation');
 }
Пример #16
0
<?php

/* @var $this ContentController */
/* @var $Content Content */
$this->breadcrumbs = array('Content');
$this->menu = array(array('icon' => 'glyphicon glyphicon-plus-sign', 'label' => 'Create Content', 'url' => array('/contentType/index')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-form form').submit(function(){\n\t\$('#content-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
$this->page_heading = 'Content';
$this->beginWidget('bootstrap.widgets.BsPanel', array('title' => '&nbsp;'));
$this->widget('application.widgets.SnapGridView', array('id' => 'content-grid', 'dataProvider' => $Content->search(), 'filter' => $Content, 'afterAjaxUpdate' => "function(){jQuery('#Content_updated').datepicker({'dateFormat':'yy-mm-dd','constrainInput':false})}", 'columns' => array(array('name' => 'title', 'type' => 'raw', 'value' => 'CHtml::link($data->title, array("/content/update","id"=>$data->id))'), array('name' => 'type', 'filter' => ContentType::getList(), 'value' => 'CHtml::value($data,"ContentType.name")'), array('name' => 'updated', 'type' => 'date', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $Content, 'attribute' => 'updated', 'htmlOptions' => array('class' => 'form-control'), 'options' => array('dateFormat' => 'yy-mm-dd', 'constrainInput' => false)), true)), array('header' => 'Last updated by', 'name' => 'search_user_updated', 'value' => 'CHtml::value($data->UserUpdated, "full_name")'), array('class' => 'bootstrap.widgets.BsButtonColumn', 'viewButtonUrl' => 'Yii::app()->controller->createFrontendUrl("/content/view/",array("id"=>$data->id))'))));
$this->endWidget();
Пример #17
0
 public function get_images()
 {
     $contentType = ContentType::get_for_model('Post', $this->post_type);
     $images = Doctrine_Query::create()->from('PjangoMedia o')->where('o.content_type_id = ? AND o.object_id = ?', array($contentType->id, $this->id))->execute();
     return $images;
 }
Пример #18
0
    echo $form->labelEx($model, 'title');
    ?>
		<?php 
    echo $form->textField($model, 'title', array('size' => 60, 'maxlength' => 250));
    ?>
		<?php 
    echo $form->error($model, 'title');
    ?>
	</div>

	<div class="row">
		<?php 
    echo $form->labelEx($model, 'content_type_id');
    ?>
		<?php 
    echo $form->DropDownList($model, 'content_type_id', CHtml::listData(ContentType::model()->findAll(array('condition' => "name <> 'text'")), 'id', 'name'), array('prompt' => 'Select Type', 'disabled' => Yii::app()->controller->action->id == 'update'));
    ?>
 
		<?php 
    echo $form->error($model, 'content_type_id');
    ?>
	</div>
	
	<div class="row">
		<label><?php 
    echo Yii::t('subject', 'Image source');
    ?>
</label>
		<?php 
    echo $form->DropDownList($model, 'image_source', array('0' => Yii::t('subject', 'My Computer'), '1' => Yii::t('subject', 'Link or URL')));
    ?>
Пример #19
0
}

///function bind_click_positions(){
  $(".set_position").live('click', function(){
	var id = $(this).html();
	$.fn.yiiGridView.update("subject-grid", {url:"",data:{"id":id, "day":$("#Subject_Position_day_"+id).val()
	,"hour":$("#Subject_Position_hour_"+id).val(), "minute":$("#Subject_Position_minute_"+id).val()   } });
  });
//}

//Auto update the grid timeboard every subject change interval

function refresh_timeboard()
{  
  $.fn.yiiGridView.update("subject-grid", {url:""});
  //self.setInterval("refresh_timeboard()",<?php 
echo Yii::app()->params['subject_interval'] * 60;
?>
000);
}


</script>


<p>Legend: <span class="row_red">RED</span> => Live NOW</p>
<?php 
$dataProvider = $model->search('t.position ASC');
$dataProvider->pagination->pageSize = 30;
$this->widget('zii.widgets.grid.CGridView', array('id' => 'subject-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'rowCssClass' => 'something', 'columns' => array(array('name' => 'id', 'id' => $live_subject["subject_id"] . '_' . $live_subject["subject_id_2"], 'type' => 'html', 'value' => '"<div class=\\"set_position\\" onClick=\\"\\">".$data->id."</div>"', 'headerHtmlOptions' => array('width' => '25px'), 'cssClassExpression' => '($data->id == substr($this->id, 0, strpos($this->id, "_"))) ? row_red : something', 'sortable' => true), array('name' => 'position', 'header' => 'Position Da/Ho/Mi', 'filter' => '', 'type' => 'raw', 'value' => 'CHtml::DropDownList("Subject_Position_day_".$data->id, date("j",$data->position), SiteLibrary::get_time_intervals("day")) . CHtml::DropDownList("Subject_Position_hour_".$data->id, date("G",$data->position), SiteLibrary::get_time_intervals("hour")). CHtml::DropDownList("Subject_Position_minute_".$data->id, date("i",$data->position), SiteLibrary::get_time_intervals("minute"))', 'headerHtmlOptions' => array('width' => '175px'), 'sortable' => true), array('name' => 'user_position', 'header' => 'User Position', 'type' => 'raw', 'value' => '($data->user_position) ? date("d",$data->user_position) . " " . date("H",$data->user_position) ." ". date("i",$data->user_position) : "--  --  --"'), array('name' => 'manager_position', 'header' => 'Manager Position', 'type' => 'raw', 'value' => '($data->manager_position) ? date("d",$data->manager_position) . " " . date("H",$data->manager_position) ." ". date("i",$data->manager_position) : "--  --  --"'), array('name' => 'user_id', 'type' => 'html', 'value' => 'CHtml::link(User::model()->findByPk($data->user_id)->username,Yii::app()->getRequest()->getBaseUrl(true)."/mysub/".User::model()->findByPk($data->user_id)->username)', 'filter' => '', 'headerHtmlOptions' => array('width' => '25px'), 'sortable' => true), array('name' => 'country_id', 'value' => '$data->country->name', 'filter' => CHtml::listData(Country::model()->findAll(), 'id', 'name'), 'sortable' => true), array('name' => 'category', 'filter' => CHtml::listData(Yii::app()->db->createCommand()->select('name')->from('subject_category')->queryAll(), 'name', 'name'), 'sortable' => true), array('name' => 'title', 'headerHtmlOptions' => array('width' => '200px'), 'type' => 'html', 'value' => 'CHtml::link($data->title,Yii::app()->getRequest()->getBaseUrl(true)."/sub/".$data->urn)'), array('name' => 'priority_id', 'value' => '$data->priority_type->name', 'headerHtmlOptions' => array('width' => '50px'), 'filter' => CHtml::listData(Priority::model()->findAll(), 'id', 'name'), 'sortable' => true), array('name' => 'content_type_id', 'value' => '$data->content_type->fullname', 'headerHtmlOptions' => array('width' => '50px'), 'filter' => CHtml::listData(ContentType::model()->findAll(), 'id', 'name'), 'sortable' => true), array('name' => 'time_submitted', 'value' => 'date("Y/m/d H:i", $data->time_submitted)', 'headerHtmlOptions' => array('width' => '100px'), 'sortable' => true)), 'enablePagination' => true));
Пример #20
0
 public function testSetValue()
 {
     $newValue = 'NewValue';
     $this->parameter->setValue($newValue);
     $this->assertSame($newValue, $this->parameter->getValue());
 }
 public function testConcreteMime()
 {
     $this->assertEquals('audio/x-wav', (string) ContentType::byString(file_get_contents(__DIR__ . '/data/sample.MP3')));
 }
Пример #22
0
 public function save($id)
 {
     $relations = array();
     //file_put_contents('post', json_encode($_POST));
     $pid = $this->input->post('pid');
     //$div_id = $this->input->post('div');
     $html = $this->input->post('html');
     if (!empty($pid)) {
         $page = Page::factory()->get_by_id((int) $pid);
         $relations[] = $page;
     }
     $content = Content::factory()->get_by_id($id);
     if (!$this->user->can_edit_content($content)) {
         if ($this->is_ajax_request()) {
             die(json_encode(array('status' => 'Error', 'message' => __("You don't have enough permissions to edit this content!"))));
         } else {
             $this->templatemanager->notify_next("You don't have enough permissions to edit this content!", 'failure');
             redirect('administration/dashboard');
         }
     }
     $old_html = $content->contents;
     $old_editor = $content->editor_id;
     $old_ts = !empty($content->updated) ? $content->updated : $content->created;
     //set/unset editors
     $editors = $this->input->post('editors');
     if (!empty($editors)) {
         $editors_users = User::factory()->where_in('id', $editors)->get();
         $not_editors_users = User::factory()->where_not_in('id', $editors)->get();
     }
     //set page and content editor
     $page->editor_id = $this->user->id;
     $content->editor_id = $this->user->id;
     //set contents
     $content->contents = empty($html) ? '' : $html;
     //save page and contents
     $page->save();
     //set content type
     $ctype_id = (int) $this->input->post('type');
     if ($ctype_id > 0 && $this->user->owns_page($page)) {
         $relations[] = ContentType::factory($ctype_id);
     }
     if ($this->user->owns_page($page)) {
         $content->is_global = $this->input->post('global') == 'yes';
     }
     //remove non and save editors
     if (!empty($editors) && $this->user->owns_page($page)) {
         $content->delete_editor($not_editors_users->all);
         $content->save_editor($editors_users->all);
     }
     $content->save($relations);
     //create revision
     $rev = new ContentRevision();
     $rev->contents = $old_html;
     $rev->user_id = $old_editor;
     $rev->created = $old_ts;
     $rev->save(array($content, $this->user));
     $this->templatemanager->notify_next(__("Content \"%s\" is saved!", $content->div), 'success');
     if ($this->is_ajax_request()) {
         echo json_encode(array('status' => 'OK', 'message' => __("Content \"%s\" is saved!", $div_id)));
     } else {
         redirect('administration/contents/edit/' . $content->id . '/' . $content->div);
     }
 }
 public function visitContent(ContentType $content)
 {
     $this->output .= __METHOD__ . ': ' . $content->getContents() . "\n";
 }
Пример #24
0
 function admin_delete($request, $taxonomy = 'Post', $id)
 {
     $post = Doctrine::getTable('Post')->find($id);
     if ($post) {
         try {
             $contentType = ContentType::get_for_model('Post', $taxonomy);
             $deleted = Doctrine_Query::create()->delete('PjangoMedia o')->where('o.site_id = ? AND o.content_type_id = ? AND o.object_id = ?', array(SITE_ID, $contentType->id, $post->id))->execute();
             $post->unlink('Categories');
             $post->save();
             $post->delete();
             Messages::Info(pjango_gettext('1 record has been deleted.'));
         } catch (Exception $e) {
             Messages::Error($e->getMessage());
         }
     }
     HttpResponseRedirect('/admin/' . $taxonomy . '/Post/');
 }
Пример #25
0
<?php

$this->breadcrumbs = array('Subjects' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List Subject', 'url' => array('index')), array('label' => 'Create Subject', 'url' => array('add')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('subject-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage Subjects</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<p>Legend: <span class="row_red">RED</span> => Live NOW</p>
<?php 
$dataProvider = $model->search();
$dataProvider->pagination->pageSize = 50;
$this->widget('zii.widgets.grid.CGridView', array('id' => 'subject-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'rowCssClass' => 'something', 'columns' => array(array('name' => 'id', 'id' => $live_subject["subject_id"] . '_' . $live_subject["subject_id_2"], 'value' => '$data->id', 'headerHtmlOptions' => array('width' => '25px'), 'cssClassExpression' => '($data->id == substr($this->id, 0, strpos($this->id, "_"))) ? row_red : something', 'sortable' => true), array('name' => 'user_id', 'type' => 'html', 'value' => 'CHtml::link($data->user->username,Yii::app()->getRequest()->getBaseUrl(true)."/mysub/".$data->user->username)', 'filter' => '', 'headerHtmlOptions' => array('width' => '25px'), 'sortable' => true), array('name' => 'country_id', 'value' => '$data->country->name', 'filter' => CHtml::listData(Country::model()->findAll(), 'id', 'name'), 'sortable' => true), array('name' => 'category', 'filter' => CHtml::listData(Yii::app()->db->createCommand()->select('name')->from('subject_category')->queryAll(), 'name', 'name'), 'sortable' => true), array('name' => 'title', 'headerHtmlOptions' => array('width' => '410px')), array('name' => 'priority_id', 'value' => '$data->priority_type->name', 'headerHtmlOptions' => array('width' => '50px'), 'filter' => CHtml::listData(Priority::model()->findAll(), 'id', 'name'), 'sortable' => true), array('name' => 'content_type_id', 'value' => '$data->content_type->fullname', 'headerHtmlOptions' => array('width' => '50px'), 'filter' => CHtml::listData(ContentType::model()->findAll(), 'id', 'name'), 'sortable' => true), array('name' => 'time_submitted', 'value' => 'date("Y/m/d H:i", $data->time_submitted)', 'headerHtmlOptions' => array('width' => '100px'), 'sortable' => true), array('name' => 'approved', 'type' => 'html', 'value' => 'CHtml::link(SiteHelper::yesno($data->approved),"moderate/".$data->id)', 'headerHtmlOptions' => array('width' => '20px'), 'filter' => array('0' => 'No', '1' => 'Yes'), 'sortable' => true), array('name' => 'authorized', 'type' => 'html', 'value' => 'CHtml::link(SiteHelper::yesno($data->authorized),"authorize/".$data->id)', 'headerHtmlOptions' => array('width' => '20px'), 'filter' => array('0' => 'No', '1' => 'Yes'), 'sortable' => true), array('name' => 'disabled', 'value' => 'SiteHelper::yesno($data->disabled)', 'headerHtmlOptions' => array('width' => '20px'), 'filter' => array('0' => 'No', '1' => 'Yes'), 'sortable' => true), array('name' => 'deleted', 'value' => 'SiteHelper::yesno($data->deleted)', 'headerHtmlOptions' => array('width' => '20px'), 'filter' => array('0' => 'No', '1' => 'Yes'), 'sortable' => true)), 'enablePagination' => true));
Пример #26
0
 public static function serverError()
 {
     return new self(ContentType::json(), '{}', 500);
 }
 function content_type()
 {
     return ContentType::ps();
 }
Пример #28
0
 public function actionInfo()
 {
     // Available contents
     $contents = ContentType::model()->findAll();
     $vars = array('contents' => $contents);
     $this->render('info', $vars);
 }
Пример #29
0
<?php

include_once getRootPath() . "/classes/core/Page.php";
include_once getRootPath() . "/classes/core/ContentType.php";
if (array_key_exists("node", $_REQUEST)) {
    $strNode = stripslashes($_REQUEST["node"]);
} else {
    $strNode = "/home";
}
if ($strNode == "") {
    $strName = "[root]";
} else {
    $strName = $strNode;
}
if (Page::isPage($strNode)) {
    $objPage = new Page($strNode);
    $objType = $objPage->getContentTypeObject();
    $strType = $objType->name;
} else {
    $strType = "content";
}
$aryTypes = ContentType::getContentTypes();
 public function index($type = '')
 {
     $this->content = View::auto();
     $contentType = new ContentType(singularize($type));
     $this->content->entries = $contentType->find();
 }