The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ItemManager 2.0
#1
Support thread for ItemManager 2.*

ItemManager (IM) is a simple flat-file framework for GetSimple-CMS that allows you to develop completely customisable PHP applications bundled with GetSimple-CMS.

ItemManager offers you a XML data management in just as straightforward a manner as if you were working with a real database. ItemManager’s powerful API is very easy and enjoyable.

Design any type of product lists (items), search and filter through the items lists by using flexible API functions. You can create a random set of categories and fields, each category is assigned any number of fields and each item is assigned one category that represent the underlying data structure, which allows a countless design combinations of the data.

ItemManager 2.3.3 changes:

Slightly API modifications have been made in order to ease the use even for non-programming developers.
The ItemManager’s initialization can now be performed within templates and/or plugins as follows:

Code:
$imanager = imanager();


Some functions for getting, finding, saving and deleting items can be called now directly:
Code:
$item = $imanager->getItem('name=Category Name', 'name=Item Name');


Get single item by category id and item id
Code:
$item = $imanager->getItem(27, 5);


Get single item by category id and item name
Code:
$item = $imanager->getItem(27, 'name=My item name');


Get multiple items by category-id and item activated
Code:
$items = $imanager->getItems(27, 'active=1');


Get all items by category-id and filter them by id in descending order
Code:
$items = $imanager->getItems(27);
$filteredItems = $imanager->filter($items, 'id', 'DESC');


Fluent Interfaces
Many of the API objects in ItemManager are chainable now, using a fluent interface. This enables you to accomplish multiple operations on one line:
Code:
echo imanager()->getItemMapper()->getItem(1)->name;


ItemManager 2.2 - 2.3 Recent changes:

Bugfixes:
  • Small cache bug fixed
  • Category order in admin. An issue with a category listings have been corrected

New Features:
  • Expire the cache method, can be used to automatically hooked to every $item->save() call
  • Simple method to count the number of items, can be used to limiting files on the disk
  • MarkupSectionCache [ Usage example ]
  • CategoryJoins [ Usage example ]


Compatibility with previous versions

The ItemManager 2.* was not only completely revised, but also totally restructured, as a result all previous versions of ItemManager are no longer compatible with ItemManager 2.* version.


What applications can be realized with the ItemManager

The ItemManager 2.0 is particularly well suited for the development of any web applications of small-sized data volumes and not excessive complexity, depending on the memory and server performance.


Requirements

The included back-end example of the ItemManager 2.* was made for modern, standards compliant browsers, older browser are not supported (please feel free to change this according to your wishes). The IM plugin has been developed on the basis of PHP 5.5.10 including some additional modules like GD, mod_rewrite (for friendly URLs/.htaccess) etc. The IM has also been tested with 5.4.26 PHP version on an Apache Server under Linux and Mac. In theory the IM will run on lower versions of PHP like 5.3.* as well but this was not tested.

Tested with:
GetSimple 3.3.4 and 3.3.5

Supported Operating Systems:
Linux x86, x86-64
Mac OS X
Windows (not tested)

Supported Web Servers:
Apache 1.3.x - 2.2.x (uses htaccess for Friendly URLs by default)


How this plugin works

Unlike previous version of IM, the IM 2.*-API has been heavily optimized, and now enables even more dynamic development. The new API offers a full range of methods required to read and write access, controlling, filtering and searching of the item, category and field data. The new modular concept also allows development of custom Fieldtypes.

Traditionally, IM comes without any predefined front-end templates and leaves developer free to code his own way. ItemManager 2.* comes with a back-end area, however, the back-end is completely customizable, based on the available API. IM 2.* allows you to cleanly separate the look of the site with the underlying function.

Installation

You can download the current version of the ItemManager under Extend. Unzip the downloaded file and copy it's contents to your plugins folder. The required data directories and configurations should be created automatically when you first access the plugin. Make sure that PHP-process has enough security permissions to access these files.

For more information (API - reference & docu) see:
http://ehret-studio.com/lab/2015/mai/itemmanager-2.0

A small tutorial how to create a simple category list:
http://ehret-studio.com/lab/2015/mai/tutorial-creating-a-simple-catalog-with-itemmanager/
Reply
#2
When I try to create a category I get the following error:

Quote:Error saving category: The category names are limited to a maximum of characters.

This is even when the name of the category is only one character long.
In the settings I am supposed to be able to set the length (which is empty by default), but settings are not saved when clicking on save-button.

Also, there's still a __MACOSX folder in the the zipfile of the plugin and .DS_Store files in a lot of folders.


In the plugin section, the title of the plugin still links to Item Manager (v 0.7)
Reply
#3
I deleted the old folders and files of old item manager in /data and now I am able to create categories.

When I delete a created category I get the following error:

Quote:Fields file could not be deleted

When I reload the the deleted category is gone though.
Reply
#4
Thanks for your feedback

(2015-05-21, 01:15:51)datiswous Wrote: Also, there's still a __MACOSX folder in the the zipfile of the plugin and .DS_Store files in a lot of folders.


Throw it in the trash if it bothers you (will be removed in the next release).

(2015-05-21, 01:32:32)datiswous Wrote: I deleted the old folders and files of old item manager in /data and now I am able to create categories.

As standard procedure: First of all, delete the old version and than install the new one.

(2015-05-21, 01:32:32)datiswous Wrote: When I delete a created category I get the following error:

Quote:Fields file could not be deleted
When I reload the the deleted category is gone though.

Well then probably no Fields file has been created?

Do you have any other issues?
Reply
#5
I actually still don't know how to get the data shown in a page. This has been an issue before (I usually just gave up). It might be that Itemmanager is operating in a different way than other plugins..

Do I have to just add some code-line to activate the plugin on a page / template (like most plugins)? If so, what is that? I tried finding the correct info on your documentation website and Github, but these seam more like examples.
Reply
#6
(2015-05-21, 03:08:40)datiswous Wrote: I actually still don't know how to get the data shown in a page. This has been an issue before (I usually just gave up). It might be that Itemmanager is operating in a different way than other plugins..

Do I have to just add some code-line to activate the plugin on a page / template (like most plugins)? If so, what is that? I tried finding the correct info on your documentation website and Github, but these seam more like examples.

Hi datiswous,

ItemManager isn’t just a plugin it’s more a tool for creating plugins, for people who are a little familiar with PHP programming language. ItemManager has no front-end, it only has an API which spits out data and allow it to the developer create own output according to their wishes.

If you have already created categories and Items, let me know what you would like to show in the front-end and I try to explain you, how you can output these. 
Reply
#7
(2015-05-21, 04:03:39)Bigin Wrote: If you have already created categories and Items, let me know what you would like to show in the front-end and I try to explain you, how you can output these. 
 
I also wonder about how this could be done more easily. It would be much much easier if the plugin included a function similar to I18N's get_i18n_search_results(), where you pass all parameters like sorting order, component to render through, amount of items etc. In effect, what this plugin misses is a simple output function that combines all of the actions in the example in the first post here: http://get-simple.info/forums/showthread.php?tid=4779. I'd probably be able to make sense of it after a day, but then again I'm looking for a plugin & not a framework with a learning curve, I'd rather use I18n special pages & I18n combined to build items through regular pages, just because the API is much more accessible. And it sucks, because I know this plugin is specifically built for item lists, and at least as sophisticated for this task.
Reply
#8
(2015-05-21, 11:29:13)Tyblitz Wrote: I also wonder about how this could be done more easily. It would be much much easier if the plugin included a function similar to I18N's get_i18n_search_results(), where you pass all parameters like sorting order, component to render through, amount of items etc. In effect, what this plugin misses is a simple output function that combines all of the actions in the example in the first post here: http://get-simple.info/forums/showthread.php?tid=4779. I'd probably be able to make sense of it after a day, but then again I'm looking for a plugin & not a framework with a learning curve, I'd rather use I18n special pages & I18n combined to build items through regular pages, just because the API is much more accessible. And it sucks, because I know this plugin is specifically built for item lists, and at least as sophisticated for this task.

You are little annoyed just because you can not handle with the API?
I see you have not really understood what the ItemManager and you are trying to compare apples and oranges here. ItemManager can do so much-much more than simply sorting and outputting the pages. Instead of getting angry, think about what you want to do exactly with ItemManger and I'll try to show you a few examples so that you will then know what possibilities ItemManager is offering.
Reply
#9
Here is just one of the many examples for people who want to know what plugins (and how simple it is) could be realized with Item Manager. Download it and follow the installation instructions. http://ehret-studio.com/lab/2015/mai/frontainer/

Plugin contains only two files + a simple theme in order to show the implementation. 
Reply
#10
Heart 
@Bigin no no I'm not angry, sorry if it appeared so; I just wanted to suggest an easy outputting function. I know (hell, I see) that ItemManager is a powerful plugin. But as you mentioned before, ItemManager is for PHP developers. And the more powerful a plugin, the more complicated. Being a front-end developer with only some PHP knowledge, looking at the examples it seemed not 'very automatic' or self-explanatory to actually output items.

But thanks for the pointer to the example, I'll surely look into it when I have some time.
Reply
#11
(2015-05-21, 20:54:36)Tyblitz Wrote: Being a front-end developer with only some PHP knowledge, looking at the examples it seemed not 'very automatic' or self-explanatory to actually output items.



You are right. I understand what you mean, the description is in fact a bit poor, but that's the reason why I started this thread.


There is another example (it outputs Items in frontend/theme):

Let's say we have a category named 'Fruits' and have created the following fields for it 'color' and 'image'
Next, create 3 fruits with the title: 'Bananas', 'Oranges', 'Cherries' 
color field values: 'yellow', 'orange', 'red'
and finally upload three pictures.

Now you go to your theme and add this code there:
PHP Code:
<?php
// get ItemManager instance
$manager = new IManager();
// check ItemManager installed
if(!$manager){die('ItemManager not installed!');}
// get ImCategory instance
$fruitsCategory $manager->getCategoryMapper()->getCategory('name=Fruits');
// check Fruits category exists
if(!$fruitsCategory){die('Fruits category does not exist!');}
// get ImItems class instance
$itemClass $manager->getItemClass();
// initialise all items of the category Fruits
$itemClass->init($fruitsCategory->get('id'));


/********** That's all, now we can work with Items! **********/

// Now, all your item data in: $itemClass->items Object

foreach($itemClass->items as $item)
{
 
   // Output item name
 
   echo 'Item Name: ' htmlspecialchars($item->name) . ' ';

 
   // Output image Nr 1
 
   if(!empty($item->fields->image->imagefullurl[0]))
 
   {
 
       echo '<img alt="" src="'htmlspecialchars($item->fields->image->imagefullurl[0]). '" width="200" >';
 
   }

 
   // output color field value
 
   if(!empty($item->fields->color->value))
 
   {
 
       echo ' Item color: 'htmlspecialchars($item->fields->color->value) . '<br /><br />';
 
   }
}
?>

I do not think that it's very difficult?! Someone with little or no PHP knowledge should be able to vaguely understand that.
Reply
#12
Ok, so I finally got to test the basic snippets of code on this page and had a brief look at the API (btw nice job of updating the documentation).
I'm convinced this plugin is awesome and could actually even be a base plugin for other plugins (am I right when I say you could even create a blog plugin based on Item Manager?)

Excited about trying out the template feature (I haven't yet);
You even create your own field types!??

What about Frontainer? Does this allow other users to register/ login, and, if it's actually a tested and working sub-plugin, why is it not in the GetSimple Extend repository?

If the plugin handles my curiosity well, there's nothing left to be desired from my part than a somewhat less cumbersome admin UI in the Fields tab... I find it a bit annoying that every field takes so much space. If I get the hang of it, I'll probably write a blog post on how to use ItemManager, and maybe create some plugin based on this one later, or create some output functions which automate the code outlined above. Big Grin
Reply
#13
(2015-06-05, 03:21:51)Tyblitz Wrote: I'm convinced this plugin is awesome and could actually even be a base plugin for other plugins (am I right when I say you could even create a blog plugin based on Item Manager?)

Yep, that is just one of the many things you can do with ItemManager.

(2015-06-05, 03:21:51)Tyblitz Wrote: You even create your own field types!??

Yes, you can create any field types you like with additional columns and even custom settings (see /imanager/module/fields/*  & /imanager/module/inputs/*)

(2015-06-05, 03:21:51)Tyblitz Wrote: What about Frontainer? Does this allow other users to register/ login, and, if it's actually a tested and working sub-plugin, why is it not in the GetSimple Extend repository?

Yes. The problem is that, Frontainer contains „Two in one“ a plugin + theme. GetSimple Extend repository does not allow me a theme located in the same archive as the plugin.

(2015-06-05, 03:21:51)Tyblitz Wrote: If the plugin handles my curiosity well, there's nothing left to be desired from my part than a somewhat less cumbersome admin UI in the Fields tab... I find it a bit annoying that every field takes so much space. If I get the hang of it, I'll probably write a blog post on how to use ItemManager, and maybe create some plugin based on this one later, or create some output functions which automate the code outlined above.  Big Grin

ItemManager doesn't really have UI. The „whole“ ItemManager backend is built using API and templates (see „im.backend.controller.class.php“). Any or all of these backend elements can be edited or changed.

To modify the style, size, etc.. of the Fields you have different opportunities:

1. Define your own CSS-Classes for this field under "Field Settings Menu" („Field area CSS Class“ „Label CSS Class“ „Field CSS Class“).

2. If the result is still insufficient, you can replace HTML templates. You can find these under "/plugins/imanager/tpl/" in your GetSimple website directory.

3. Finally, you can even hook into the ItemManager backend methods to totally customize its style and to modify its behavior without touching a single line of ItemManger's source code.
Here’s an example: http://ehret-studio.com/lab/2015/mai/callback-stack/

Have a lot of fun in experimenting ;-)
Reply
#14
Hi Bigin,

Here's my bug report for ItemManager 2.0, a few suggestions and a simple question:

1-If you sort the categories with drag&drop, go to another tab and return to the Categories tab, the categories disappear. The way to get them back is to go to Settings and click on "Save".

2-If you sort the categories with drag&drop and then double-click on the position number to change it, some weird characters appear there ("/>).

3-The ascending or descending sort order you select in the settings for categories is not working. It's always descending.

4-The position number in the category list does not always match the number you see when editing a category. In general, there is a problem with the ordering of categories.

5-The input field that appears when you double click on a category or item position number can't be changed with the mouse, only with keyboard. If you click on the up or down arrows to change the number, the field disappears.

6-Reordering the items with drag&drop works as expected: if you have 4 items and drag 3 to first position, 1 becomes 2 and 2 becomes 3. But when editing an item, changing the position number has no effect. It can't be changed, even though the field is editable. I think it should have the same effect as drag&drop, especially if we consider that drag&drop is not always possible when there are more than 50 items in a category.

7-When creating a new item, I think the position field should be pre-filled with the next available position. That is the number the field will get if nothing is written.

8-If you double click on a position in the items list ("view all" tab), you can change it numerically. This has a strange effect. Position numbers of other items do not change accordingly, and repeated position numbers are displayed. If there are repeated position numbers, drag&drop stops working properly.

9-If you create a new custom field with a name that already exists and click on "confirm", you get a message that says "The field names must be unique. The duplicates have been removed." That might be fine, more or less, if the removed field is always the new one. But if you try to rename an existing custom field and write the name of another existing custom field (by mistake or for whatever reason), one of them is removed without previous warning, and that's not good. I think the best thing you can do here is to do nothing, just not to rename the custom field.

10-When you're editing a category or an item, you can see some information that can't be edited: id, Created date and Updated date. It's OK, but I think it should be presented in a different and more compact way, not as if they were editable fields. Perhaps above, and all in a line. And when you're editing or creating an item, I think it would be useful to see there the category to which it belongs.

11-I think the "add new" button shouldn't be highlighted when you're editing an item. It's a bit confusing. You're not adding a new item, you're editing an existing one. And when you add a new item, the "add new" button should turn black after clicking on "save", indicating that if you change the data and click "save" again, you won't be adding an item, but changing the one you've just created. In short, I think the "add new" button should be highlighted only when the immediate effect of clicking "save" is to create a new item.

12-There is a checkbox to the right of the image fields. I don't know what it is for, and if selected, the selection is not saved.

13-If you delete custom fields from a category, the data is not deleted from the XML files of items, creating unnecessarily large files. If XML files of all items must be loaded into RAM to make operations with them, it does not seem a good idea to have useless tags and data there.

I noticed that now a variable number of images can be uploaded to an image field. This is fine, it makes this plugin a little more flexible, but it's a limited solution: You can't add descriptions to images, alt or title attributes, links... If items of different categories could be freely combined, flexibility would be much higher. The problem of iterating through irregular arrays or objects could be easily solved, I think: "if the object is of type 1, do this, if it's of type 2, do that..." (but I'm not sure that would be so easy, I'm not expert in PHP).

As I said in previous posts, I've been searching for quite some time the perfect CMS for people with low computer skills who want a small website. Very, very simple for the end user, but very flexible for the designer. Something that allow the end user to combine fragments of predesigned HTML code, change their content, and nothing else. The closest thing I've found is this, but it's not exactly a CMS, and it's quite expensive if you want to access the source code. ItemManager is a good solution. I especially like the automated management of the images, and the possibility to hide all tabs in GetSimple except ItemManager, thus avoiding potential problems with the unskilled users. It doesn't fit exactly with what I'm looking for, but it's the best solution I've found so far.


And now the question. I've been reading the API reference. I'm not sure this is the shorter or the most efficient way to create a custom field... but it works:

PHP Code:
$manager = new IManager();
$fields $manager->getFieldsClass();
//Create a XML fields file for category with id=2 if it doesn't exist:
if (!$fields->fieldsExists(2)) {$fields->createFields(2);}
$fields->init(2);
//Create a custom text field "my_field_name" in the category with id=2 if it doesn't exist:
$my_field $fields->getField('name=my_field_name');
if(!
$my_field) {
$newField $manager->newField(2);
$newField->name 'my_field_name';
$newField->type 'text';
$newField->save();


Where and in what file can I write this code (or similar) if I want certain custom fields to appear by default in each new category created from the back-end?

That's all!
Reply
#15
Hi Rico,

thank you very much for your report, it will definitely help me to improve some things!

(2015-06-10, 08:51:55)Rico Wrote: And now the question. I've been reading the API reference. I'm not sure this is the shorter or the most efficient way to create a custom field... but it works:



PHP Code:
$manager = new IManager();
$fields $manager->getFieldsClass();
//Create a XML fields file for category with id=2 if it doesn't exist:
if (!$fields->fieldsExists(2)) {$fields->createFields(2);}
$fields->init(2);
//Create a custom text field "my_field_name" in the category with id=2 if it doesn't exist:
$my_field $fields->getField('name=my_field_name');
if(!
$my_field) {
$newField $manager->newField(2);
$newField->name 'my_field_name';
$newField->type 'text';
$newField->save();


Where and in what file can I write this code (or similar) if I want certain custom fields to appear by default in each new category created from the back-end?

That's all!

I have little time, so I am being brief.

Unfortunately that what you plan to do, is not quite so simple since you are trying to access one of the „Model“ -Method, which is called within the „ImBackend“ class. It’s possible but a little inconvenient.

First off, create a new plugin/file named „im.extender.php“ for example, in „/plugins/„ directory. Then you simply add the following code in this file:

PHP Code:
<?php
$thisfile 
basename(__FILE__'.php');

register_plugin(
    
$thisfile,
    
'Your plugin name',
    
'0.1',
    
'Your name',
    
'your website url',
    
'An ItemManger backend extension',
    
'',
    
''
);

add_action('ImActivated''action');

function 
action($manager) {

    if(!
class_exists('ImBackend'))
    {
        return 
'Error: ImBackend class does not exist!';
    }

    class 
BackendExtended extends ImBackend
    
{
        protected function 
callModelMethod($method$args)
        {
            if(
$method == 'createCategoryByName')
            {
                
/* Here you can add a new method call (instead of original "createCategoryByName"),
                   something like that, for example:
                */
                
return $this->myCreateCategory($args[0], $args[1]);

            } else
            {
                
$multiargs = array('deleteItem');
                if(
$method == 'deleteItem' || $method == 'deleteCategory' || $method == 'updateCategory')
                {
                    return 
$this->manager->{$method}($args[0], $args[1]);
                }
                return 
$this->manager->{$method}($args);
            }
        }


        
/* Here put your own "Model" method to save Category  */
        
protected function myCreateCategory($cat$refresh=false)
        {

            
/* Ok, let's copy and paste the code from the original "createCategoryByName" method
               located in the "im.model.class.php" file here. Next we'll modify a little the code.
               NOTE: You must use "$this->manager" instead of using just "$this->", because you are now in
               "ImBackend" and not in "ImModel" class
            */

            
if(empty($cat)) return false;

            if(!
is_string($cat)) return false;

            if(
false !== strpos($cat'='))
            {
                
$data explode('='$cat2);
                
$key strtolower(trim($data[0]));
                
$val trim($data[1]);
                if(
false !== strpos($key' '))
                    return 
false;

                if(
$key != 'name')
                    return 
false;

                
$cat $val;
            }

            
$config $this->manager->config;

            if(
strlen($cat) > $config->common->maxcatname)
            {
                
ImMsgReporter::setClause('err_category_name_length', array('count' => $config->common->maxcatname));
                return 
false;
            }
            
// CHECK here category name
            
$new_cat = new Category();
            
$new_cat->set('name'str_replace('"''\''$cat));

            
$new_cat->slug ImModel::toAscii($cat);

            
// do not save category if name already exists
            
if(!$this->manager->category->getCategory('name='.safe_slash_html($new_cat->name)))
            {
                
$new_cat->save();

                
/******* And here is the place for pasting your code: ********/

                
$fields $this->manager->getFieldsClass();

                
// Create the fields file for "each" new category:
                
$cat_id $new_cat->get('id');
                if(!
$fields->fieldsExists($cat_id))
                {
                    
$fields->createFields($cat_id);
                    
$fields->init($cat_id);
                    
// Create a custom text field "my_field_name" in the new category if it doesn't exist:
                    
$my_field $fields->getField('name=my_field_name');
                    if(!
$my_field) {
                        
$newField $this->manager->newField($cat_id);
                        
$newField->name 'my_field_name';
                        
$newField->label 'Your field label';
                        
$newField->position 1;
                        
$newField->type 'text';
                        
$newField->save();
                    }
                }

            } else
            {
                
ImMsgReporter::setClause('err_category_name_exists', array());
                return 
false;
            }

            
// reinitialize categories
            
if($refresh$this->manager->category->init();

            
ImMsgReporter::setClause('successfull_category_created', array(
                    
'category' => safe_slash_html($new_cat->name))
            );
            return 
true;
        }
    }

    
$newbackend = new BackendExtended($manager);
    
$manager->setBackend($newbackend);


As the final step activate new plugin in „GetSimple“ Plugin menu.

A big thanks again!
Reply
#16
Hi Bigin,
Thank you very much for the "im.extender" plugin! It works perfectly.
I'm glad to help. My next web project is a very simple website for a small business. Probably I won't start until September. If by then you've had time to improve this plugin a bit, it will be very useful.
Reply
#17
Hi Bigin !

At last I succeeded building my sample IM little DB ...

Now 2 separate questions regarding images :

1- Is it possible to have several image fields per record ?
( still the error msg : The image upload field can only be used once per item. )

2- I see IM is generating Thumbnails then could you let me know the code in order to have the Thumbnail on GS page and have the large image in a box onclick

My Best Regards
Eric
Reply
#18
Hi Eric

(2015-08-16, 20:51:10)Erick67 Wrote: 1- Is it possible to have several image fields per record ?
( still the error msg : The image upload field can only be used once per item. )

currently it's not possible to use multiple upload fields per item, but you can still use multiple images per field. However, you can change that by editing the upload field module, if you are comfortable with PHP language.

(2015-08-16, 20:51:10)Erick67 Wrote: 2- I see IM is generating Thumbnails then could you let me know the code in order to have the Thumbnail on GS page and have the large image in a box onclick

Let me show you a few examples based on the Fruits category above:
http://get-simple.info/forums/showthread.php?tid=7293&pid=51357#pid51357

Let's say one of your items named 'Cherries' looks like this:
[Image: imanager.2014_cherries01.jpg?dl=0]


To show your items in your Theme, try the following:
PHP Code:
// get IM instance
$manager = new IManager();
// get Category & Item class instances
$categoryClass $manager->getCategoryClass();
$itemClass $manager->getItemClass();
// to get an instance of the fruits category, by category name for example: 
$fruits_cat $categoryClass->getCategory('name=Fruits');

// initialize all items of the Fruits-category by fruits category id
$itemClass->init($fruits_cat->get('id'));

// here are all your items of category fruits
echo '<pre>';
print_r($itemClass->items);
echo 
'</pre>'

If you do print_r($itemClass->items); then you will see a long list with your Item-objects. Scroll down to [image] => Field Object. Here you can see all papameter you can use to build your output, for example:
Code:
[image] => Field Object
(
    [categoryid:protected] => 6
    [file:protected] => /Applications/MAMP/htdocs/imanager.2014/data/imanager/fields/6.im.fields.xml
    [filename:protected] => 6.im.fields.xml
    [id:protected] => 2
    [confirmed:protected] => 0
    [name] => image
    [label] => Images
    [type] => imageupload
    [position] => 2
    [default] =>
    [options] => Array
    (
    )

    [info] =>
    [required] =>
    [minimum] =>
    [maximum] =>
    [areaclass] =>
    [labelclass] =>
    [fieldclass] =>
    [configs] => stdClass Object
    (
    )

    [created] => 1432209888
    [updated] =>
    [areacss] =>
    [labelcss] =>
    [fieldcss] =>
    [value] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/
    [imagename] => Array
    (
        [0] => sharry.jpg
        [1] => lex_kirschen.jpg
    )

    [imagepath] => Array
    (
        [0] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/
        [1] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/
    )

    [imagefullpath] => Array
    (
        [0] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/sharry.jpg
        [1] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/lex_kirschen.jpg
    )

    [imageurl] => Array
    (
        [0] => http://imanager.2014/data/uploads/imanager/3.6/
        [1] => http://imanager.2014/data/uploads/imanager/3.6/
    )

    [imagefullurl] => Array
    (
        [0] => http://imanager.2014/data/uploads/imanager/3.6/sharry.jpg
        [1] => http://imanager.2014/data/uploads/imanager/3.6/lex_kirschen.jpg
    )
   )
)

Shall we say, we wish to get only item named 'Cherries':
PHP Code:
$sherry $itemClass->getItem('name=Cherries'); 

To get all parameter of your image field, you can do following: [objectname]->[fields]->[your_field_name]:
PHP Code:
echo '<pre>';
print_r($sherry->fields->image);
echo 
'</pre>'

So let us make it a bit shorter:
PHP Code:
$image $sherry->fields->image

If you simple want to get a default thumbnail (created automaticly by ItemManager during the upload) you can do:
PHP Code:
echo '<pre>';
print_r($image->imageurl[0].'thumbnail/'.$image->imagename[0]);
echo 
'</pre>'

If you want to create your own thumbnails any size you want. So you can use 'phpthumb' class (already included in IM 2.0, but currenty not yet implemented in core)
PHP Code:
require_once(GSPLUGINPATH.'imanager/phpthumb/ThumbLib.inc.php'); 

The library allows you to show an image after manipulation or save it to the filesystem. More info: https://github.com/masterexploder/PHPThumb/wiki/Basic-Usage

Sample, resize image and save it:
PHP Code:
$thumb PhpThumbFactory::create($image->imagefullurl[0]);
$thumb->resize(150);
$thumb->save($image->imagepath[0].'thumbnail/150_'.$image->imagename[0], 'jpg');
echo 
'<pre>';
print_r($image->imageurl[0].'thumbnail/150_'.$image->imagename[0]);
echo 
'</pre>'

Markup:
PHP Code:
echo '<img alt="" src="'.$image->imageurl[0].'thumbnail/150_'.$image->imagename[0].'">'

Hope this helps
Reply
#19
Hi Bigin !

Thanks a lot for your help. I am getting further quicker now ...

However there is something I don't understand :

When I am using only one image = perfect ! ... in your above example : imagename[0] = sharry.jpg

Problem is when I go back to the record and upload a 2nd image the second image becomes imagename[0] and sharry.jpg becomes imagename[1] ???

When is it coming from ? .... as I would like always 1st image uploaded being imagename[0]

Best Regards
Eric
Reply
#20
The following uploads are assigned in sequential order. upload1: $image->imagename[0], upload2: $image->imagename[1] etc…
You can change the order of the images by drag and drop + save.

Regards
Reply
#21
Another option is to loop through your images to localize the image you wish by name:

PHP Code:
foreach($your_item->fields->image->imagename as $imagename) {
    if(
$imagename == 'your_image.jpg')
        echo 
$imagename;

Reply
#22
Thanks for above code ... I think I can manage from there for a start

However I did all possible tests regarding my previous message and can't fix the issue


Quote:the second image becomes imagename[0] and sharry.jpg becomes imagename[1] ???

It would be far easier if first uploaded image would always be imagename[0]
Regards
Eric
Reply
#23
Ok, I'll check that soon, could be an issue. Thx
Reply
#24
(2015-08-17, 18:30:18)Bigin Wrote: The following uploads are assigned in sequential order. upload1: $image->imagename[0], upload2: $image->imagename[1] etc…
You can change the order of the images by drag and drop + save.

Regards

Actually I find this kind of counter-intuitive. I would expect this to work like a PHP array_push; so that the new upload is added after instead of before. If I get it correctly when I state: "Every time you add a new image, you have to change the template to keep the display as before", it should be changed IMO.
Reply
#25
ItemManager 2.1 is available for download

http://get-simple.info/extend/plugin/ite...er-21/936/
https://github.com/bigin/ItemManager_2.0/tree/master
Reply




Users browsing this thread: 2 Guest(s)