Development

Slides for ASU presentations

Attached below are the slides I used for both the March and April ASU Drupal Users' Group presentations I did. The first was on Content Access and Workflows and discussed the setting up effective content creation workflows with corresponding access controls. The second covered an intro Content Creation Kit (CCK) and Views. See the lists below for modules / sites referenced in the presentations.

Content Access and Workflows presentation

Simple Workflow + Actions

Workflow NG

Other stuff referenced

CCK & Views presentation

Referencing an array in a variable object property

Update:
Thanks to an anonymous commenter for letting me know that this is an issue of operator precedence.

This is more a personal note than anything, but I've been banging my head against a wall trying to figure out how to reference an array within a variably-named object property in PHP. Having not found anything very useful when search Google, I figure my post may end up being someone's helpful search result. Maybe I just don't know the right terminology for what I'm trying to do...?

Anyways, I've got a module that needs to modify the string in a CCK text field before it's shown to users on the node edit form. It's a "glue" module that helps us handle course enrollment, and the field in question handles course instructor(s) via a comma-delimited list of usernames. The module takes the user's submitted data, parses it into an array and stores each username in a table joined with course ID for other uses (such as passing to our Sakai installation). The CCK field is referenced in several places, so I use an admin settings form to allow us to say, "This CCK field is the field that users fill out to define instructors." This allows us to avoid hard-coding the CCK field name all over our glue module, but it also led to the headache I encountered today.

When a user goes back to the form to edit the course, I want to present the username list cleanly (alphabetical, no accidental whitespace, etc). Here's the code I tried to use:

function ideal_courses_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  // ... (irrelevant stuff here)

    case 'prepare':
      $field_instructors = variable_get('ideal_courses_field_instructors', NULL);
      // The line that fails is below:
      $node->$field_instructors[0]['value'] = ideal_courses_instructors_as_string($node);
    break;

  // ... (more irrelevant stuff here)
}

The error I kept getting was, "PHP Fatal error: Cannot use string offset as an array." The strange thing is that doing a print_r($node->$field_instructors); works fine. The fix was simple, but difficult to find: wrap the variable property name in curly braces: $node->{$field_instructors}[0]['value']. The full result is below:

function ideal_courses_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  // ... (irrelevant stuff here)

    case 'prepare':
      $field_instructors = variable_get('ideal_courses_field_instructors', NULL);
      // Fixed line is below:
      $node->{$field_instructors}[0]['value'] = ideal_courses_instructors_as_string($node);
    break;

  // ... (more irrelevant stuff here)
}

Drupal Node Overview training materials

I'm wrapping up my first semester of classes in ASU's Educational Technology Master's program, and the final project for my EDT502 (Design and Development of Instruction) class was to design a program of instruction. It was strongly recommended to us to keep the program length to one hour, and to choose something we were familiar with. So, of course, I chose Drupal!

This one hour training program was designed to be a focused and quick introduction to Drupal's node system. The target audience is potential Drupal developers who have experience administering Drupal, and its major focus is on presenting nodes as objects that can be modified by modules. It has three main objectives:

  • present an overview of Drupal's node structure in easy to understand terms;
  • provide attendees with useful tools for inspecting the structure of a node; and
  • give attendees the knowledge required to identify where and when nodes are modified.

I envision this being just one unit in a much larger set of materials that provide a solid introduction to Drupal development. I'm pretty excited about what I was able to come up with, and have started sketching out plans for other units. I've decided to post this unit up here to see if I can get any feedback, and to see if anyone is interested in helping me make the full program of instruction a reality. Please see the attachments below for the full final project. I've included everything. Please feel free to let me know what you think!

Some development notes

This is probably just about the most obvious observation to anyone who has written a technical training program or book before... but, man it's a lot of work! But, it's also incredibly rewarding and satisfying. At the same time, I'm not sure I see myself doing it for anything but material I'm passionate about and I certainly have no desire to be a full time instructional designer. I'm a little worried this could cause... issues... with the rest of my time in the Ed Tech program, but I'm optimistic that it won't.

Apple's Pages '08 is an incredible application and I credit using it with giving my project a level of polish I never would have been able to achieve on my own. I have nothing but praise for the way that Apple has solved issues that have plagued Microsoft Word for years. The UI is incredibly simple and straightforward, and accomplishing fairly complex tasks is a snap. I'm very excited to continue using it in my work.

Google Docs is great for just about every word processing task I have in my daily work. Most of my text heavy documents are written in Google Docs and never leave Google Docs. The framework there provides an awesome solution for taking notes, planning projects and collaborating. However, it is not good for writing materials that you intend to be well designed and printable with reasonably predictable results. I spent quite a few hours porting material from the Google Docs in which I drafted the project to Pages, and the process was not smooth. Next time, I'll plan ahead and start something like this in Pages right off the bat - and I'll just use Subversion as my change management tool.

Update:
I've added the project retrospective, called the Program Development Report, which I just finished up today. See the attachments for the PDF.

If you're coming from the front page or an RSS reader, follow the "read more" link below for the attachments.

Syndicate content