Using views in drupal simplenews - drupal-6

I am using Drupal 6.x and Simplenews to send newsletters. I want to build the mailing list using email address field of student content type. Is there a way to use views to get email address of all the students in the system to send newsletters to them?

sure you can get all e-mails of students go to "Administrator section - views"
1- Add a new view and give it name "for example : test" .
2- You'll then find a section called filter "press on it and add node type equal to student content types".
3- In Fields section choose the "email field for student".
4- don't forget to make "Items to display" at Basic settings section to be unlimited .
To check the view results you'll find at the end a live preview to check the results.
In order to get the view result
$view = views_get_view('test'); // where test is the view name
$view->set_display('default'); // in case it's page "page-0" in case block "block-0"
$view->pre_execute();
$view->execute();
$result = $view->result;
the second part it to take this result and make a custom module to send to these students the news letter .

Related

Populate data back to form in Kentico

Here's what I'd like to do but not sure how to. I have a form that's like a typical doctor/school form, where the form has 2 sections: [1] Section 1 at the top is for user (with standard fields like First Name, Last Name etc.), and [2] Section 2 at the bottom is for Admin/Office use only (with fields like Reviewed by, Approved/Not Approved etc.)
what I was able to do is to process Section 1 where I got ALL users' submission and display all their data on a webpage using a RepeaterWithCustomQuery. That's pretty basic. But in order to do what described above, I guess that I'll need to pull the submitted data and populate them back to Section 1 of the form (maybe as readonly data at this time) and then the Office/Admin staff can fill in Section 2.
I hope I made sense and hope that someone can point me to the right direction. I only use Portal Engine, no access to file system or backend.
I think I understand your issue you want to have some sort of an editor for biz form data. Similar to what you have in the admin. And the problem is that you don't have access to backend. :( Such thing is available for custom table data (there is web part), but not for biz form data. There is no ready to use web part. Here is old topic on that https://devnet.kentico.com/questions/how-to-edit-the-information-of-a-record-using-the-bizform-layout.
you want to have something like the admin page for editing form records:
/CMSModules/BizForms/Tools/BizForm_Edit_EditRecord.aspx?formID=7&formRecordID=1
but customized :(. I'd say without back end access the only options I see:
Create a new role "Biz Form Editor" (or use existing) that has rights only to edit biz
form data. So all your people who do "validation" part must have a
Kentico account with role "Biz Form Editor".
Add link above to your repeater with appropriate record id.
P.S. There are special code names for alternative forms (https://docs.kentico.com/k8/configuring-kentico/creating-alternative-forms/code-names-of-automatically-used-alternative-forms). If you create an alternative form with special name update the system will automatically load it when you edit the record.
Not sure that I understood correctly your question. But what you need is to use alternative forms. So the idea is that one form is for "registration" and the 2nd one for "validation".
So in your registration form you show only firstName, lastName etc and you don't show "validation" fields. In the validation form you show firstName, lastname etc as label and show textboxes for validation fields.

Does Drupal provides interchanged/partial word search facility?

Does Drupal provides interchanged/partial word search for example: If i'm searching for "search term" should also return search result says that "term search".
Actually there's a quick way to set this up with the Search API and the Search API Database Search modules. No need for Solr.
Enable both the modules and go to the Search API configuration page
(admin/config/search/search_api)
Add a server and give it a recognizable name (such as "MySQL"), make sure it's enabled
Choose the following service class: Database service (normally the only option. If you don't see it, make sure that the "Search API Database Search" module is enabled).
Selecting this service class will provide you the option Search on parts of a word (make sure you enable it). Now hit "Create server". Next, go back to the Search API configuration page, and add an index. Again give it a recognizable name, such as "Contentindex", and make sure it's enabled.
Select the server you recently created (in this example "MySQL"). Datasource options: check the content types you want to index (the description of this field may be a bit confusing, but make no mistake: you should check the content types you want to index, not the ones you want to leave out).
You could check "Index items immediately", but that depends on the size of your content. This option is alright for smaller websites. In the other case: let cron take care of it. Hit "Create index".
Next, you want to enable the fields (in the fields tab) to that very index, e.g.: contant type, title, status and author - and hit "Save changes" (we'll take care of the related fields later).
Then you want to configure the filters (in the filter tab). Here you can enable the bundle filter, if you want to finetune the content types once again (probably won't need to).
Down below you'll find the highlight filter, to highlight the search word in the results.
Now return to the fields tab and unfold the "Add related fields" tab. Add all the fields of which you want to get the content indexed, and hit Save Finally go to the "view" tab of the index, and index now all the items.
The last step is to create search results page and search block in Views, which only takes a few minutes.
Make sure the submodule Search Views is enabled and create a view page which will show "Contentindex" (select the name you gave to your index configuration instead of "content" which is selected by default.
Add all the fields (make sure your format is "fields") that every search result should consist of (title [link to content], body, …).
You'll notice that these fields look like this Indexed Node: Title
Add an exposed filter: Search: Fulltext search; and select the following in its settings: Contains any of these words, and use as: Search keys.
You're done!
There's an excellent video tutorial on this partial search method without Solr, which also incorporates faceted search (which is not necessary for partial search, but in case you're interested…). If you're only looking for a partial search option, you can watch the video until 5:08 and after that skip to 6:45.
Reference:
https://www.drupal.org/node/84631

How can I display the result of an LDAP query (in my case a list of OUs), done with some Java code, in a IBM Notes Dialog List?

I'd like to add a list of strings to a Dialog list with an Java agent. Item's value changes but it doesn't show the values on form.
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db=session.getCurrentDatabase();
Form form = db.getForm("UOs_AD");
Document document = agentContext.getDocumentContext();
Item item = document.getFirstItem("UO_AD");
Vector v = new Vector();
v.addElement("Bicycle");
v.addElement("Train");
v.addElement("Foot");
Item textListItem = document.replaceItemValue("UO_AD", null);
textListItem.setValues(v);
textListItem.setSummary(true);
document.save(true, true);
I'm not sure that I understand your question. Are you trying to update the Form so that "Bicycle", "Train" and "Foot" will be choices in the dialog list whenever someone creates or edits a document? Or are you trying to update a specific document so that these three values are selected for the field value? Your code appears to be updating the Document.
If you are just trying to get those three values to appear as selected, then make sure that your field has the "Allow values not in list" property selected in Domino Designer. Also, make sure that the "Allow multiple values" property is selected.
replaceItemValue() only replaces the value of a field in the current document (which you got via agentContext.getDocumentContext()) and not the choices that, for example, a Combobox tied to that field offers the user.
If the choices a Combobox offers are static you need to use Domino Designer to open the form the document is based on and change the values offered for the choices in that field. If you want to do that programmatically, you would have to work with DXL.
OK, so based on your latest feedback, your question really should have been:
How can I display the result of an LDAP query (in my case a list of OUs), done with some Java code, in a IBM Notes Dialog List?
You are out of luck with "classic" Domino Designer. A classic notes form only offers you (either via the Designer, but also via DXL) the following options for a dialog list:
Enter choices (one per line): Type a list of choices in the edit box.
Use formula for choices: Type a Lotus Notes formula in the formula window to generate a list of choices.
Use Address dialog for choices: This option displays the Names dialog box so users can select names from a Personal Address Book or Domino Directory.
Use Access Control list for choices: This option brings up a list of people, servers, groups, and roles in the access control list for the database
Use View dialog for choices: This option brings up a dialog box containing entries from a column in a view
So no way of adding the output of some Java code to the Dialog List.
What you can do is:
Use XPages. With XPages, you can have Java code to fill any kind of List, Dialog Box, ...
Use your Java code in a scheduled Notes Agent to "sync" the LDAP entries into the Notes database by creating notes documents, eg. "OU" which represent the LDAP entries. Using a View, you could then use the "Use View dialog for choices" option of the Dialog List to display them to the user.
Use TDI (entitlement for this comes with Domino) to sync the LDAP entries into the Notes database by creating notes documents, eg. "OU" which represent the LDAP entries. Using a View, you could then use the "Use View dialog for choices" option of the Dialog List to display them to the user.
Use your Java code in a scheduled Notes Agent to update a field inside a profile document with the list of "OUs". Then use a #-formula to display the values in the Dialog List.
Solution (2), (3) and (4) have the disadvantage of not displaying "realtime" info of the LDAP directory.
I hope I understood your problem correctly. If so, please edit content and title of your question acccordingly.

Creating a view of users who have created nodes

Basically i want to creeate a block diaplay view,which displays a list of all the users thata have posted some nodes on the drupal website.
Oddly enough thinking about this right now it could be a little tricky. You have two possible solutions off the top of my head.
1 - Create a new view of item type Node. Your row style will obviously be set to Fields. Under which Fields to pull select the User group and then tick off the User: Name checkbox. Set your Items to display setting to 0 for unlimited results.
Under the preview you should get a ton of results looking something like:
Name: John Doe
Name: Mary Jane
Name: John Doe
Name: Anonymous
What you're seeing is the authors of all the nodes posted in your system. There will be duplication because a user in your system could be the author of multiple nodes. Unfortunately you can't just tick off the Distinct: Yes option because this only applies to nodes and not the users.
How to deal with the duplicate user name results tho? Custom theme your view by creating a custom template under Theme: information. Inside the template write some PHP code which intercepts the row results from the View query before it renders and only render distinct user names from the results. You'd have to write the logic though to determine whether a user name has already been added.
As simple as creating a new custom array, adding each row result (user name) to array but first checking to see whether it already exists in your custom array - if it does then toss it and move on to the next user name. At the end you'll have an array filled with distinct user names who have posted on your site.
voila! It works. It's not elegant but it definitely will work if built this way.
2 - Alternatively maybe you can get this module working to accomplish the same thing in a less complicated manner: http://drupal.org/project/views_customfield but I have never used it so I cannot comment on it.
Good luck. Hope that helps.
My solution was to:
Create a view of people
Add a UID field (and any other fields you want)
Create a theme.tpl.php file for the Row Style
Do a DB call on each loop through the row to search for nodes created by the supplied UID.
Here is what I have in my semanticviews-view-fields-VIEWNAME.tpl.php
<?php
//Query the Drupal DB for nodes associated to the supplied UID
$existing_nid = db_query("SELECT nid FROM {node} WHERE (type = :ctype) AND uid = :uid", array("ctype" => "CONTENT_TYPE", "uid" => $fields['uid']->content))->fetchField();
//If the supplied UID created content of the supplied type, then show their name
if ($existing_nid != FALSE) {
echo "Name:" . $fields['name']->content;
}
?>
This way only UID's that have content associated to it in the DB will be printed out, and those that don't, won't.
Hope that helps!

Using the search module to display entries based on custom fields

I have a profile weblog that contains all our users details (fields seperate from the membership).
These users can submit application forms with the use of a SAEF (stand alone entry form), which will be stored in an applications weblog. Inside this applications weblog, I have a relationship field which assigns a profile to an application.
Inside this application, radio buttons are contained to allow an admin to change the status of that application (an example, a judge views an application for Joe Bloggs and sets this application to “winner”).
What I essentially need to do is filter out all the profiles that have not been set to a number of status’. So if I apply for an application and the judge is yet to view this application, my profile should not appear in the search results. My idea of this is that I would somehow have to intertwine search results with a reverse related entry tag, and as my knowledge of the search module is limited I am at a complete loss if this is even possible.
As you can see, not only do I need to search by custom field, but the profiles that will be displayed should be determined on custom fields contained in the application entry.
I would suggest using the "status" option instead of the radio custom field.
Why? Because you can accomplish the same thing you want to do with the radio field and you can set what entries you want to return in your search results.
For example, you have a status group called: "Application", which is assigned to the that weblog/channel
Within the status group, you will have three options: Pending (waiting to be looked at), Loser (judge sets it to this because it is not a winner, or just as pending), Winner (judge considers that application a winner).
Then in the search tag, you would set what statuses it will return in the search results
so if you want to only return applications/profiles that were marked winner, you would set the status="status_id" (this will be the id of "Winner" status)

Resources