diff --git a/flower_bouquet/flower_bouquet.info b/flower_bouquet/flower_bouquet.info new file mode 100755 index 0000000..07408c3 --- /dev/null +++ b/flower_bouquet/flower_bouquet.info @@ -0,0 +1,5 @@ +name = "Flower Bouquet" +description = "Flower bouquet module" +core = 7.x +package = "Hello" +version = 7.x-1.x diff --git a/flower_bouquet/flower_bouquet.install b/flower_bouquet/flower_bouquet.install new file mode 100755 index 0000000..a39a024 --- /dev/null +++ b/flower_bouquet/flower_bouquet.install @@ -0,0 +1,65 @@ + t('Flower table'), + 'fields' => array( + 'id' => array( + 'description' => t('Primary key for flower table'), + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'name' => array( + 'description' => t('Flower Name'), + 'type' => 'varchar', + 'not null' => FALSE, + 'length' => 20, + ), + 'color' => array( + 'description' => t('Color of the flower'), + 'type' => 'varchar', + 'length' => '15', + 'not null' => FALSE, + ), + ), + 'primary key' => array('id'), + ); + + $schema['bouquet'] = array( + 'description' => t('Bouquet Creation'), + 'fields' => array( + 'bid' => array( + 'description' => t('ID for bouquet'), + 'type' => 'serial', + 'not null' => TRUE, + 'unsigned' => TRUE, + ), + + 'name' => array( + 'description' => t('Bouquet name'), + 'type' => 'varchar', + 'length' => 20, + 'not null' => FALSE, + ), + + 'id' => array( + 'description' => t('flower id'), + 'type' => 'int', + 'unsigned' => TRUE, + ), + + 'qty' => array( + 'description' => t('Number of flowers to added into the bouquet'), + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + ), + ), + 'primary key' => array('id'), + ); + + + return $schema; +} diff --git a/flower_bouquet/flower_bouquet.module b/flower_bouquet/flower_bouquet.module new file mode 100755 index 0000000..60dd0c3 --- /dev/null +++ b/flower_bouquet/flower_bouquet.module @@ -0,0 +1,416 @@ + 'Create Flower', + 'access callback' => TRUE, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('flower_bouquet_create_flower_form'), + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + ); + + $items['flowers_view'] = array( + 'title' => 'View Flowers', + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + 'page callback' =>'flower_bouquet_view_flower_form', + 'access arguments' => array('access flowers'), + + ); + + $items['flower/%/delete'] = array( + 'title' => 'Delete Flower', + 'access callback' => TRUE, + 'page callback' => 'flower_bouquet_flower_delete_form', + 'page arguments' => array(1), + 'type' => MENU_DEFAULT_LOCAL_TASK, + + ); + + $items['update_flower_qty/%'] = array( + 'title' => "Update Flower Qty", + 'page callback' => 'drupal_get_form', + 'page arguments' => array('flower_bouquet_flower_update_qty_form', 1), + 'access callback' => TRUE, + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + ); + + $items['create_bouquet'] = array( + 'title' => 'Create Bouquet', + 'access callback' => TRUE, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('flower_bouquet_create_bouquet_form'), + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + ); + + $items['bouquets_view'] = array( + 'title' => 'View Bouquets', + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + 'page callback' =>'bouquets_view', + 'access arguments' => array('access_flower_bouquet'), + ); + + $items['add_flower_bouquet/%'] = array( + 'title' => 'Add flower', + 'page callback' =>'drupal_get_form', + 'page arguments' => array('flower_bouquet_add_flower_bouquet_form',1), + 'access callback' => TRUE, + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + + ); + + $items['bouquet/%/delete'] = array( + 'title' => 'Delete bouquet', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'page callback' =>'bouquet_delete', + 'page arguments' => array(1), + //'access arguments' => array('access flower_bouquet'), + 'access callback'=> TRUE, + ); + + return $items; +} + +function flower_bouquet_create_flower_form($form, &$form_state){ + $form['name'] = array( + '#type' => 'textfield', + '#title' => 'Flower name', + '#size' => 30, + '#maxlength' => 30, + '#required' => TRUE, + ); + + + $form['color'] = array( + '#type' => 'textfield', + '#title' => 'Flower Color', + '#size' => 30, + '#maxlength' => 30, + '#required' => TRUE, + ); + + $form['qty'] = array( + '#type' => 'textfield', + '#title' => 'Qty', + '#required' => TRUE, + ); + + $form['price'] = array( + '#type' => 'textfield', + '#title' => 'Price(1Pc)', + '#required' => TRUE, + ); + +$form['submit_button'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + + ); + + return $form; +} + +function flower_bouquet_create_flower_form_validate($form, &$form_state) { +} + +function flower_bouquet_create_flower_form_submit($form, &$form_state) { +db_insert('flower') + ->fields(array( + 'color' => $form_state['values']['color'], + 'name' => $form_state['values']['name'], + 'qty' => $form_state['values']['qty'], + 'price' => $form_state['values']['price'], + )) + ->execute(); +drupal_set_message(t('Flower has been added!!!')); +drupal_goto('flowers_view'); +} + + +function flower_bouquet_view_flower_form(){ + $query=db_select('flower','f'); + $header=array(t('Flower'),t('Color'),t('Stock'), t('Price(1Pc)') ,t('Delete'), t('Update Qty')); +$results = $query + ->fields('f',array('name','color', 'qty','price', 'id')) + ->condition('flag', 1) + ->execute(); +$rows = array(); + + foreach($results AS $result) { + $rows[] = array( + t($result->name), + t($result->color), + t($result->qty), + t($result->price), + l('Delete','flower/'.$result->id.'/delete'), + l('Edit Qty', 'update_flower_qty/'.$result->id), + ); + } + + return theme('table', array('header' => $header, 'rows' => $rows)); +} + +function flower_bouquet_flower_delete_form($item){ + $query = db_update('flower') + ->fields(array('flag' => 0)) + ->condition('id', $item, '=') + ->execute(); + drupal_set_message(t('Flowers has been deleted!')); + drupal_goto('flowers_view'); +} + +function flower_bouquet_flower_update_qty_form($form, &$form_state, $item){ + $form['id'] = array( + '#type' => 'hidden', + '#value' => t($item), + ); + $form['qty'] = array( + '#type' => 'textfield', + '#title' => 'Qty', + '#required' => TRUE, + ); + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Update'), + ); + return $form; +} + +function flower_bouquet_flower_update_qty_form_validate($form, &$form_state){ +} + +function flower_bouquet_flower_update_qty_form_submit($form, &$form_state){ + $id = $form_state['values']['id']; + $qty = $form_state['values']['qty']; + $sel = db_select('flower', 'f') ->fields('f', array('qty')) ->condition('id', $id, '=') ->execute() ->fetch(); + $qty = $qty + ($sel->qty); + $res = db_update('flower') ->fields(array('qty' => $qty)) ->condition('id', $id, '=') ->execute(); + drupal_set_message('Qty is updated'); + drupal_goto('flowers_view'); +} + +function flower_bouquet_create_bouquet_form($form, &$form_state) { + + $form['uname'] = array( + '#type' => 'textfield', + '#title' => 'Your Name', + '#size' => 30, + '#maxlength' => 30, + '#required' => TRUE, + ); + $form['addr'] = array( + '#type' => 'textfield', + '#title' => 'Your Address', + //'#size' => 30, + //'#maxlength' => 30, + '#required' => TRUE, + ); + $form['phone'] = array( + '#type' => 'textfield', + '#title' => 'Your Phone number', + '#required' => TRUE, + ); + + $form['name'] = array( + '#type' => 'textfield', + '#title' => 'Your Bouquet name', + '#size' => 30, + '#maxlength' => 30, + '#required' => TRUE, + ); + +$form['submit_button'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + + ); + + return $form; +} + + + +function flower_bouquet_create_bouquet_form_validate($form, &$form_state) { +} +function flower_bouquet_create_bouquet_form_submit($form, &$form_state) { +$id = db_insert('bouquet') + ->fields(array( + 'uname' => $form_state['values']['name'], + 'address' => $form_state['values']['addr'], + 'phone' => $form_state['values']['phone'], + 'name' => $form_state['values']['name'], + 'date' => $form_state[date('Y-m-d h:i:s')], + )) + ->execute(); +//drupal_set_message(t($id)); +//drupal_set_message(t('Bouquet has been created!!!')); +drupal_goto('add_flower_bouquet/'.$id); +} + +function flower_bouquet_add_flower_bouquet_form($form, &$form_state, $id=0){ + $form['field_container'] = array( + '#type' => 'container', + '#weight' => 80, + '#tree' => TRUE, + // Set up the wrapper so that AJAX will be able to replace the fieldset. + '#prefix' => '
', + '#suffix' => '
', + ); + $form_state['field_deltas'] = isset($form_state['field_deltas']) ? $form_state['field_deltas'] : range(0, 0); + $field_count = $form_state['field_deltas']; + foreach ($field_count as $delta) { + $form['field_container'][$delta] = [ + '#type' => 'container', + '#attributes' => [ + 'class' => ['container-inline'], + ], + '#tree' => TRUE, + ]; + $form['field_container'][$delta]['bid'] = array( + '#type' => 'hidden', + '#value' => t($id), + ); + $result = db_select('flower', 'f')->fields('f', array('id', 'name','color')) ->condition('flag', 1, '=') ->execute()->fetchAll(); + $options = array(); + foreach ($result as $value) { + $options[$value->id] = $value->name.' '. $value->color; + } +$form['field_container'][$delta]['flower'] = array( + '#type' => 'select', + '#title' => 'Select Flower', + '#options' => $options, + '#required' => TRUE, +); + $form['field_container'][$delta]['qty'] = array( + '#type' => 'textfield', + '#title' => 'Qty', + '#required' => TRUE, + '#size' => 10, + ); + //dpm($form_state['values']); + + } + $form['field_container']['add_name'] = [ + '#type' => 'submit', + '#value' => t('Add one more'), + '#submit' => ['flower_bouquet_ajax_add_more_add_one'], + '#ajax' => [ + 'callback' => 'flower_bouquet_ajax_add_more_add_one_callback', + 'wrapper' => 'js-ajax-elements-wrapper', + ], + '#weight' => 100, + ]; + + $form['field_container']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + //'#submit' => ['flower_bouquet_add_flower_bouquet_form_submit'], + + ); + return $form; +} + + +function flower_bouquet_ajax_add_more_add_one($form, &$form_state) { + $form_state['field_deltas'][] = count($form_state['field_deltas']) > 0 ? max($form_state['field_deltas']) + 1 : 0; + $form_state['rebuild'] = TRUE; + drupal_get_messages(); + +} + +function flower_bouquet_ajax_add_more_add_one_callback($form, &$form_state) { + for($i=0; $ifields('f', array('id','qty' )) ->condition('id', $id, '=') ->execute() ->fetch(); + if (($res->qty) < $qty){ + dpm(t($qty.' flowers is not available')); + return; + } + } + return $form['field_container']; +} + +function flower_bouquet_add_flower_bouquet_form_validate($form, &$form_state) { +} +function flower_bouquet_add_flower_bouquet_form_submit($form, &$form_state) { + $row = $form_state['values']['field_container']; + $var = $form_state['values']['bid']; + $len = sizeof($row); + $count = 1; + $total_price = 0; + foreach ($row as $item) { + if($count < $len-1){ +// dpm($item['flower']); +// dpm($item['qty']); +// dpm($item['bid']); + $id = $item['flower']; + $qty = $item['qty']; + $res = db_select('flower', 'f') ->fields('f', array('qty', 'price')) ->condition('id', $id, '=') ->execute() ->fetch(); + $total_price = $total_price + ($res->price * $item['qty']); + if($total_price < 500){ + //drupal_set_message('Your bouquet cost exceeded 500rs, Sorry bouquet is not created.'); + drupal_goto('add_flower_bouquet/'.$item['bid']); + db_insert('bouquet_flower') + ->fields(array( + 'id' => $item['flower'], + 'qty' => $item['qty'], + 'bid' => $item['bid'], + )) + ->execute(); + $qty = ($res->qty) - $qty; + db_update('flower') + ->fields(array('qty' => $qty)) + ->condition('id', $id, '=') + ->execute(); + } + } + $count++; + } +drupal_set_message('Bouquet has been created. And bouquet cost is '.$total_price); +drupal_goto('create_bouquet'); +} + + +function bouquets_view(){ + $query=db_select('bouquet','f'); + $query->innerJoin('bouquet_flower', 'fb', 'f.bid=fb.bid'); + $query->innerJoin('flower','fs','fb.id=fs.id'); + $query->addField('fs','name','fname'); + $query->addField('fs', 'color', 'fcolor'); + $query->addField('fb', 'qty', 'qty'); + $header=array(t('Bouquet name'),t('Flower'),t('Qty'),t('Delete')); + $results = $query + ->fields('f',array('uname', 'name', 'bid')) + ->distinct('f.name') + ->condition('f.flag', 1) + ->execute(); +$rows = array(); + foreach($results AS $result) { + $rows[] = array( + //t($result->uname), + t($result->name), + t($result->fname.' '.$result->fcolor), + t($result->qty), + l('Delete','bouquet/'.$result->bid.'/delete'), + ); + } + + return theme('table', array('header' => $header, 'rows' => $rows)); +} + +function bouquet_delete($item){ +$query = db_update('bouquet') + ->fields(array('flag' => 0)) + ->condition('bid', $item, '=') + ->execute(); +drupal_set_message(t('Bouquet has been deleted!')); +drupal_goto('bouquets_view'); +} + diff --git a/flower_bouquet/flower_bouquet.sql b/flower_bouquet/flower_bouquet.sql new file mode 100644 index 0000000..7bebdff --- /dev/null +++ b/flower_bouquet/flower_bouquet.sql @@ -0,0 +1,116 @@ +-- MySQL dump 10.16 Distrib 10.2.14-MariaDB, for Linux (x86_64) +-- +-- Host: localhost Database: drupaldb +-- ------------------------------------------------------ +-- Server version 10.2.14-MariaDB + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `flower` +-- + +DROP TABLE IF EXISTS `flower`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `flower` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL, + `color` varchar(15) NOT NULL, + `qty` int(10) unsigned DEFAULT NULL, + `flag` tinyint(1) DEFAULT 1, + `price` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `id` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `flower` +-- + +LOCK TABLES `flower` WRITE; +/*!40000 ALTER TABLE `flower` DISABLE KEYS */; +INSERT INTO `flower` VALUES (1,'Rose','White',30,0,10),(2,'Rose','Red',30,0,10),(3,'Rose','Yellow',30,0,10),(4,'Lilly','white',30,0,10),(5,'Rose','Purple',30,0,10),(10,'Rose','Green',40,1,10),(11,'Rose','White',30,1,10),(12,'Rose','brown',30,0,10),(13,'Rose ','Orange',30,1,10),(14,'Lilly','Blue',30,1,10),(15,'Lilly','White',50,1,5); +/*!40000 ALTER TABLE `flower` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `bouquet` +-- + +DROP TABLE IF EXISTS `bouquet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bouquet` ( + `bid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(20) DEFAULT NULL, + `uname` varchar(30) NOT NULL, + `address` varchar(50) DEFAULT NULL, + `phone` bigint(20) NOT NULL, + `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `flag` tinyint(1) DEFAULT 1, + PRIMARY KEY (`bid`), + UNIQUE KEY `bid` (`bid`), + UNIQUE KEY `phone` (`phone`) +) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `bouquet` +-- + +LOCK TABLES `bouquet` WRITE; +/*!40000 ALTER TABLE `bouquet` DISABLE KEYS */; +INSERT INTO `bouquet` VALUES (1,'B2','B2','Vijaya nagara',9844,'2018-06-15 05:19:24',0),(2,'B1','B1','Vijaya nagara',9844633501,'2018-06-15 08:19:29',0),(3,'B3','B3','Vijaya nagara',9844633502,'2018-06-14 06:55:12',1),(4,'B4','B4','Vijaya nagara',9844633500,'2018-06-14 06:55:12',1),(5,'B9','B9','Vijaya nagara',9844633505,'2018-06-14 06:55:12',1),(6,'B2','B2','Vijaya nagara',99999,'2018-06-12 09:12:37',1),(7,'B2','B2','Vijaya nagara',0,'2018-06-12 09:26:25',1),(8,'B2','B2','Vijaya nagara',9880,'2018-06-12 10:05:29',1),(9,'B2','B2','Vijaya nagara',9844633504,'2018-06-12 10:11:23',1),(10,'b6','b6','Vijaya nagara',987,'2018-06-12 10:23:12',1),(11,'B2','B2','Vijaya nagara',9844633507,'2018-06-12 10:29:53',1),(12,'B2','B2','Vijaya nagara',1,'2018-06-12 10:38:55',1),(13,'B2','B2','Vijaya nagara',2,'2018-06-12 10:40:59',1),(14,'B2','B2','Vijaya nagara',3,'2018-06-12 10:43:49',1),(15,'Bouq1','Bouq1','Vijaya nagara',988888,'2018-06-12 13:00:23',1),(16,'Bouq1','Bouq1','Vijaya nagara',9876,'2018-06-12 13:08:00',1),(17,'B2','B2','Vijaya nagara',123,'2018-06-12 13:40:08',1),(19,'B2','B2','Vijaya nagara',12309,'2018-06-13 11:32:16',1),(20,'BouqJohn','BouqJohn','Bengaluru',9844555555,'2018-06-15 07:52:57',1),(21,'BouqJohn','BouqJohn','Bengaluru',984455555,'2018-06-15 07:56:53',1); +/*!40000 ALTER TABLE `bouquet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `bouquet_flower` +-- + +DROP TABLE IF EXISTS `bouquet_flower`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bouquet_flower` ( + `bflid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `bid` bigint(20) unsigned NOT NULL, + `id` bigint(20) unsigned NOT NULL, + `qty` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`bflid`), + KEY `id` (`id`), + KEY `bid` (`bid`), + CONSTRAINT `bouquet_flower_ibfk_1` FOREIGN KEY (`id`) REFERENCES `flower` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `bouquet_flower` +-- + +LOCK TABLES `bouquet_flower` WRITE; +/*!40000 ALTER TABLE `bouquet_flower` DISABLE KEYS */; +INSERT INTO `bouquet_flower` VALUES (1,58,13,1),(2,1,1,10),(3,2,14,10),(4,14,11,12),(5,3,1,1),(6,3,13,1),(7,3,13,1),(8,3,11,1),(9,3,11,1),(10,3,11,1),(11,3,11,1),(12,3,10,12),(13,3,2,1),(14,3,14,12),(15,3,3,3),(16,1,1,1),(17,4,4,4),(18,1,1,1),(19,1,1,1),(20,1,1,1),(21,1,1,1),(22,5,5,5),(23,1,1,1),(24,1,1,1),(25,1,1,1),(26,1,1,1),(27,3,3,3),(28,1,1,1),(29,1,1,1),(30,4,13,13),(31,2,1,1),(32,2,12,12),(33,2,13,12),(34,2,1,12),(35,2,13,1),(36,1,13,10),(37,1,12,12),(38,1,2,10),(39,1,13,1),(40,1,14,12),(41,1,2,1),(42,1,13,12),(43,1,13,1),(44,1,13,1),(45,1,13,12),(46,1,14,1),(47,1,13,1),(48,1,10,12),(49,1,13,1),(50,1,5,1),(51,1,11,12),(52,1,13,1),(53,1,1,9),(54,1,10,12),(55,1,13,3),(56,1,12,6),(57,1,14,9),(58,1,14,1),(59,1,11,2),(60,1,11,12),(61,1,13,1),(62,1,10,1),(63,1,14,3),(64,1,3,12),(65,1,2,1),(66,1,14,1),(67,1,13,3),(68,1,14,30),(69,1,14,30),(70,1,14,30),(71,1,14,30),(72,1,14,30),(73,1,14,30),(74,1,14,30),(75,1,14,25),(76,1,14,25),(77,1,14,20),(78,1,14,20),(79,1,14,2),(80,1,12,1),(81,1,14,30),(82,1,13,1),(83,1,10,5),(84,1,10,5),(85,1,10,1),(86,1,10,4),(87,1,10,5),(88,1,10,5),(89,1,11,5),(90,1,1,10),(91,1,1,10),(92,1,1,10),(93,1,2,10),(94,1,2,10),(95,1,4,10),(96,1,3,20),(97,1,4,20),(98,1,5,20),(99,21,15,20); +/*!40000 ALTER TABLE `bouquet_flower` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-06-18 11:06:24 diff --git a/helloWorld/helloworld.info b/helloWorld/helloworld.info new file mode 100755 index 0000000..65b3c43 --- /dev/null +++ b/helloWorld/helloworld.info @@ -0,0 +1,5 @@ +name = "Hello World" +description = "Demo module created" +core = 7.x +package = "Hello" +version = 7.x-1.x diff --git a/helloWorld/helloworld.module b/helloWorld/helloworld.module new file mode 100755 index 0000000..7c62813 --- /dev/null +++ b/helloWorld/helloworld.module @@ -0,0 +1,67 @@ + 'Hello World', + 'access callback' => TRUE, + 'page callback' => 'helloworld_hello_page', + 'type' => MENU_NORMAL_ITEM, + 'menu' => 'navigation', + ); + + return $items; +} + + +function helloworld_hello_page() { + return t('Hello Every one'); +} + + +/*function mymodule_menu() { + $items = array(); + + $items['my_module/hello_world'] = array( + 'title' => 'Hello World Test', + 'page callback' => 'say_hello_world', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); + + return $items; +} + +function say_hello_world() { + $vars = array(); + $vars['type']="ul"; + $vars['title'] = ""; + $vars['attributes']=array(""); + $vars['items'][0]="This is a simple proof of concept module"; + + return theme_item_list($vars); +} +*/ +/*function hello_init(){ + drupal_set_message('Hello_chethan'); +} + +function hello_menu(){ + $items = array(); + $$items['hello_world'] = array( + 'title' => 'Hello', + 'description' => 'Hello User', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('hello_showHelloForm'), + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_NORMAL_ITEM + ); + return $items; +} + + +function hello(){ + return "Hello"; +} */ \ No newline at end of file diff --git a/landing_page/includes/landing_page_views_default.inc b/landing_page/includes/landing_page_views_default.inc new file mode 100755 index 0000000..646818e --- /dev/null +++ b/landing_page/includes/landing_page_views_default.inc @@ -0,0 +1,91 @@ +disabled = FALSE; /* Edit this to true to make a default page disabled initially */ +$page->api_version = 1; +$page->name = 'anonymous_users'; +$page->task = 'page'; +$page->admin_title = 'Anonymous Users'; +$page->admin_description = 'Landing page for anonymous users'; +$page->path = 'anonymoususers'; +$page->access = array(); +$page->menu = array( + 'type' => 'normal', + 'title' => 'Anonymous Users', + 'name' => 'main-menu', + 'weight' => '2', + 'parent' => array( + 'type' => 'none', + 'title' => '', + 'name' => 'navigation', + 'weight' => '0', + ), +); +$page->arguments = array(); +$page->conf = array(); +$page->default_handlers = array(); +$handler = new stdClass(); +$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ +$handler->api_version = 1; +$handler->name = 'page_anonymous_users__panel_context_1c8e26a4-0006-46f2-91a5-77edb2e028fa'; +$handler->task = 'page'; +$handler->subtask = 'anonymous_users'; +$handler->handler = 'panel_context'; +$handler->weight = 0; +$handler->conf = array( + 'title' => 'Landing page', + 'no_blocks' => FALSE, + 'pipeline' => 'ipe', + 'body_classes_to_remove' => '', + 'body_classes_to_add' => '', + 'css_id' => '', + 'css' => '', + 'contexts' => array(), + 'relationships' => array(), + 'name' => '', + 'access' => array( + 'plugins' => array( + 1 => array( + 'name' => 'role', + 'settings' => array( + 'rids' => array( + 0 => 1, + ), + ), + 'context' => 'logged-in-user', + 'not' => FALSE, + ), + ), + 'logic' => 'or', + ), +); +$display = new panels_display(); +$display->layout = 'flexible'; +$display->layout_settings = array(); +$display->panel_settings = array( + 'style_settings' => array( + 'default' => NULL, + 'center' => NULL, + ), +); +$display->cache = array(); +$display->title = 'it\'s looks you are anonymous users, please login'; +$display->uuid = 'de82c787-8872-4e6c-82d5-0d04cf9ce5c7'; +$display->content = array(); +$display->panels = array(); +$display->hide_title = PANELS_TITLE_FIXED; +$display->title_pane = '0'; +$handler->conf['display'] = $display; +$page->default_handlers[$handler->name] = $handler; + + + +// Add view to list of views to provide. + $views[$view->name] = $page; + + // Repeat all of the above for each view the module should provide. At the + // end, return array of default views. + return $views; + +} \ No newline at end of file diff --git a/landing_page/landing_page.info b/landing_page/landing_page.info new file mode 100755 index 0000000..a6db192 --- /dev/null +++ b/landing_page/landing_page.info @@ -0,0 +1,8 @@ +name = "Landing Page Module" +description = "Landing Page Module" +core = 7.x +package = "Views" +version = 7.x-1.x +dependencies[] = views +files[] = landing_page.module +files[] = includes/landing_page_views_default.inc \ No newline at end of file diff --git a/landing_page/landing_page.module b/landing_page/landing_page.module new file mode 100755 index 0000000..dd7c604 --- /dev/null +++ b/landing_page/landing_page.module @@ -0,0 +1,8 @@ + 3, + 'path' => drupal_get_path('module', 'landing_page') . '/includes', + ); +} \ No newline at end of file diff --git a/users_information_view/includes/users_information_views_default.inc b/users_information_view/includes/users_information_views_default.inc new file mode 100755 index 0000000..35187e2 --- /dev/null +++ b/users_information_view/includes/users_information_views_default.inc @@ -0,0 +1,87 @@ +name = 'users_information'; +$view->description = ''; +$view->tag = 'default'; +$view->base_table = 'node'; +$view->human_name = 'Users Information'; +$view->core = 7; +$view->api_version = '3.0'; +$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + +/* Display: Master */ +$handler = $view->new_display('default', 'Master', 'default'); +$handler->display->display_options['title'] = 'Users Information'; +$handler->display->display_options['use_more_always'] = FALSE; +$handler->display->display_options['access']['type'] = 'perm'; +$handler->display->display_options['cache']['type'] = 'none'; +$handler->display->display_options['query']['type'] = 'views_query'; +$handler->display->display_options['exposed_form']['type'] = 'basic'; +$handler->display->display_options['pager']['type'] = 'some'; +$handler->display->display_options['pager']['options']['items_per_page'] = '5'; +$handler->display->display_options['style_plugin'] = 'list'; +$handler->display->display_options['row_plugin'] = 'fields'; +/* Field: Content: Title */ +$handler->display->display_options['fields']['title']['id'] = 'title'; +$handler->display->display_options['fields']['title']['table'] = 'node'; +$handler->display->display_options['fields']['title']['field'] = 'title'; +$handler->display->display_options['fields']['title']['label'] = ''; +$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; +$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; +/* Field: Content: Email */ +$handler->display->display_options['fields']['field_email']['id'] = 'field_email'; +$handler->display->display_options['fields']['field_email']['table'] = 'field_data_field_email'; +$handler->display->display_options['fields']['field_email']['field'] = 'field_email'; +/* Field: Content: Name */ +$handler->display->display_options['fields']['field_name']['id'] = 'field_name'; +$handler->display->display_options['fields']['field_name']['table'] = 'field_data_field_name'; +$handler->display->display_options['fields']['field_name']['field'] = 'field_name'; +/* Field: Content: Phone Number */ +$handler->display->display_options['fields']['field_phone_number']['id'] = 'field_phone_number'; +$handler->display->display_options['fields']['field_phone_number']['table'] = 'field_data_field_phone_number'; +$handler->display->display_options['fields']['field_phone_number']['field'] = 'field_phone_number'; +/* Field: Content: Address */ +$handler->display->display_options['fields']['field_address']['id'] = 'field_address'; +$handler->display->display_options['fields']['field_address']['table'] = 'field_data_field_address'; +$handler->display->display_options['fields']['field_address']['field'] = 'field_address'; +$handler->display->display_options['fields']['field_address']['click_sort_column'] = 'country'; +$handler->display->display_options['fields']['field_address']['settings'] = array( + 'use_widget_handlers' => 1, + 'format_handlers' => array( + 'address' => 'address', + ), +); +/* Sort criterion: Content: Post date */ +$handler->display->display_options['sorts']['created']['id'] = 'created'; +$handler->display->display_options['sorts']['created']['table'] = 'node'; +$handler->display->display_options['sorts']['created']['field'] = 'created'; +$handler->display->display_options['sorts']['created']['order'] = 'DESC'; +/* Filter criterion: Content: Published */ +$handler->display->display_options['filters']['status']['id'] = 'status'; +$handler->display->display_options['filters']['status']['table'] = 'node'; +$handler->display->display_options['filters']['status']['field'] = 'status'; +$handler->display->display_options['filters']['status']['value'] = 1; +$handler->display->display_options['filters']['status']['group'] = 1; +$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; +/* Filter criterion: Content: Type */ +$handler->display->display_options['filters']['type']['id'] = 'type'; +$handler->display->display_options['filters']['type']['table'] = 'node'; +$handler->display->display_options['filters']['type']['field'] = 'type'; +$handler->display->display_options['filters']['type']['value'] = array( + 'registrat_form' => 'registrat_form', +); + +/* Display: Block */ +$handler = $view->new_display('block', 'Block', 'block'); + + +// Add view to list of views to provide. + $views[$view->name] = $view; + + // Repeat all of the above for each view the module should provide. At the + // end, return array of default views. + return $views; + +} \ No newline at end of file diff --git a/users_information_view/users_information_view.info b/users_information_view/users_information_view.info new file mode 100755 index 0000000..04ebe7b --- /dev/null +++ b/users_information_view/users_information_view.info @@ -0,0 +1,8 @@ +name = "User Information Module" +description = "User Information View Module " +core = 7.x +package = "Views" +version = 7.x-1.x +dependencies[] = views +files[] = users_information_view.module +files[] = includes/users_information_views_default.inc \ No newline at end of file diff --git a/users_information_view/users_information_view.module b/users_information_view/users_information_view.module new file mode 100755 index 0000000..0ebf56f --- /dev/null +++ b/users_information_view/users_information_view.module @@ -0,0 +1,8 @@ + 3, + 'path' => drupal_get_path('module', 'users_information_view') . '/includes', + ); +} \ No newline at end of file